You are viewing a single comment's thread. Return to all comments →
using namespace std;
int main() { int x, y; cin >> x >> y; string temp; getline(cin, temp); string Reference; getline(cin, Reference); string Pattern; getline(cin, Pattern);
string buf; stringstream ss(Pattern); vector <string> tokens; bool flag = false; int count = 0; while(ss >> buf) { tokens.push_back(buf); } vector<string>::iterator it; vector<string> RefTokens; stringstream sS(Reference); string Buf; while(sS >> Buf) { RefTokens.push_back(Buf); } vector<string>::iterator jt; for(it = tokens.begin(); it != tokens.end(); ++it) { string str = *it; flag = false; for(jt = RefTokens.begin(); jt != RefTokens.end(); ++jt) { string Str = *jt; if(str == Str) { flag = true; count++; } } if(!flag) { break; } } if(flag) { cout << "Yes"; } else { cout << "No"; } return 0;
}
//Hey Gerasiov //What is wrong with my c++ solution. It is giving wrong an //swer for some test cases.
Seems like cookies are disabled on this browser, please enable them to open this website
Hash Tables: Ransom Note
You are viewing a single comment's thread. Return to all comments →
include
include
include
using namespace std;
int main() { int x, y; cin >> x >> y; string temp; getline(cin, temp); string Reference; getline(cin, Reference); string Pattern; getline(cin, Pattern);
}
//Hey Gerasiov //What is wrong with my c++ solution. It is giving wrong an //swer for some test cases.