-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaoj0226.cpp
50 lines (46 loc) · 991 Bytes
/
aoj0226.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;
const int INF = 1<<29;
const double EPS = 1e-8;
typedef vector<int> vec;
typedef pair<int,int> P;
struct edge{int to,cost;};
int main(){
while(1){
string r,a;
cin >> r >> a;
if(r=="0")break;
int hit = 0, blow = 0;
for(int i=0;i<4;i++){
if(r[i]==a[i]){
r[i] = '-';
a[i] = '-';
hit += 1;
}
}
for(int i=0;i<4;i++){
if(r[i]=='-')continue;
for(int j=0;j<4;j++){
if(r[i]==a[j]){
blow += 1;
break;
}
}
}
cout << hit << " " << blow << endl;
}
return 0;
}