Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <iostream>
- using namespace std;
- bool isOK(string table,string cards){
- if (table[0]==cards[0] || table[1]==cards[1])
- return true;
- else
- return false;
- }
- int main()
- {
- bool ok = false;
- string table,cards;
- cin >> table;
- for (int i=0;i<5;i++){
- cin >> cards;
- ok = isOK(table,cards);
- if (ok == true){
- break;
- }
- }
- if (ok == true)
- cout << "YES";
- else
- cout << "NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement