-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathF_Two_Strings.cpp
More file actions
45 lines (41 loc) · 793 Bytes
/
F_Two_Strings.cpp
File metadata and controls
45 lines (41 loc) · 793 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
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include <string>
#include <map>
#define FastIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
using namespace std;
int main()
{
FastIO
string s;
string s2;
int n;
cin >> n;
while (n--)
{
map<char, int> db;
cin >> s;
cin >> s2;
bool isCommon = false;
for (int i = 0; i < s.size(); i++)
{
db.insert({s[i], 0});
}
for (int i = 0; i < s2.size(); i++)
{
if (db.find(s2[i]) != db.end())
{
isCommon = true;
}
}
if (isCommon)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
}