Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define fastread() (ios_base::sync_with_stdio(false),cin.tie(NULL));
- int main()
- {
- fastread()
- int t;
- cin>>t;
- for(int j=1;j<=t;j++)
- {
- vector<string>phn;
- int n;
- cin>>n;
- string s;
- for(int i=0;i<n;i++)
- {
- cin>>s;
- phn.push_back(s);
- }
- sort(phn.begin(),phn.end());
- bool x=false;
- for(int i=0;i<n-1;i++)
- {
- s= phn[i+1].substr(0,phn[i].size());
- if(s==phn[i])
- {
- x=true;
- break;
- }
- }
- printf("Case %d: ",j);
- if(x)printf("NO\n");
- else printf("YES\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement