You are viewing a single comment's thread. Return to all comments →
i did exactly the same.
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { int t; cin>>t; for(int i=0;i<t;i++) { string in1,in2; cin>>in1>>in2; int start = int('a'); int end = int('z'); int array[end+1-start]; bool flag = false; for(int j=0;j<(end+1-start);j++) array[j] = 0; for(int j=0;j<in1.length();j++) if(array[(int)in1[j]-start]==0) array[(int)in1[j]-start] = 1; for(int j=0;j<in2.length();j++) if(array[(int)in2[j]-start]==1) { flag = true; break; } if(flag) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Two Strings
You are viewing a single comment's thread. Return to all comments →
i did exactly the same.