-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempCodeRunnerFile.cpp
More file actions
33 lines (30 loc) · 864 Bytes
/
tempCodeRunnerFile.cpp
File metadata and controls
33 lines (30 loc) · 864 Bytes
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
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<string> answer(3);
vector<string> guess(3);
vector<char> visited;
for(int i=0;i<3;i++){
cin >> answer[i];
}
for(int i=0;i<3;i++){
guess[i];
}
int yellow=0,green=0;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(answer[i][j]==guess[i][j]) green++;
else if(find(visited.begin(),visited.end(),guess[i][j])==visited.end()){
yellow+=count(answer.begin(),answer.end(),guess[i][j]);
for(int k=0;k<3;k++){
for(int l=0;l<3;l++){
if (guess[i][j]==answer[i][ j]) yellow--;
}
}
visited.push_back(guess[i][j]);
}
}
}
cout << green << endl;
cout << yellow << endl;
}