https://vjudge.net/problem/CodeForces-1097A
Input
AS
2H 4C TH JH AD
Output
YES
Input
2H
3D 4C AC KD AS
Output
NO
Input
4D
AS AC AD AH 5H
Output
YES
如果能找到和输入一样字符的输出YES ,
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
string s,a;
int flag =0;
cin>>s;
for(int i=0; i<5; i++)
{
cin>>a;
if(s[0]==a[0]||s[1]==a[1])
{
flag =1;
}
}
if(flag == 1)
cout<<"YES";
else
cout<<"NO";
return 0;
}