You are viewing a single comment's thread. Return to all comments →
You can just use 1 find instead of duplicate, here is my example:
int n{}; string a{}; string b{}; int count{}; cin >> n; for (int i = 0; i < n; i++) { count = 0; cin >> a >> b; for (auto c : a) { if (b.find(c) != string::npos) { count++; break; } } (count > 0) ? cout << "YES" << endl : cout << "NO" << endl; }
Seems like cookies are disabled on this browser, please enable them to open this website
Two Strings
You are viewing a single comment's thread. Return to all comments →
You can just use 1 find instead of duplicate, here is my example: