Advertisement
Guest User

Untitled

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