这道题怎么做
如图 #include <iostream>#include <vector>
#include <map>
using namespace std;
vector<string> A;
vector<string> B;
int main(void) {
string temp;
map<char, int> alphabet;
int yellow = 0, green = 0;
for (int i = 'A'; i <= 'Z'; ++i) {
alphabet = 0;
}
for (int i = 0; i < 3; ++i) {
cin >> temp;
A.push_back(temp);
for (const char& c : temp) {
alphabet++;
}
}
for (int i = 0; i < 3; ++i) {
cin >> temp;
B.push_back(temp);
}
for (int r = 0; r < 3; ++r) {
for (int c = 0; c < 3; ++c) {
if (A == B) {
green++;
alphabet]--;
}
else if (alphabet]) {
yellow++;
alphabet]--;
}
}
}
cout << green << endl;
cout << yellow << endl;
return 0;
}
页:
[1]