SHARE
TWEET

Untitled

a guest Dec 11th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top