01 Enumeration

https://vjudge.net/problem/CodeForces-1097A
the Input
the AS
2H TH 4C JH the AD
the Output
YES
the Input
2H
3D 4C the AC KD the AS
the Output
NO
the Input
4D
the AS the AD the AH the AC 5H
the Output
YES
if you can find the same input and output character 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;
}
Published 144 original articles · won praise 7 · views 8050

Guess you like

Origin blog.csdn.net/weixin_43918196/article/details/104442829