Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. bool isOK(string table,string cards){
  7. if (table[0]==cards[0] || table[1]==cards[1])
  8. return true;
  9. else
  10. return false;
  11. }
  12.  
  13. int main()
  14. {
  15. bool ok = false;
  16. string table,cards;
  17. cin >> table;
  18. for (int i=0;i<5;i++){
  19. cin >> cards;
  20. ok = isOK(table,cards);
  21. if (ok == true){
  22. break;
  23. }
  24. }
  25. if (ok == true)
  26. cout << "YES";
  27. else
  28. cout << "NO";
  29.  
  30.  
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement