Advertisement
Saleh127

CF 1397A

Aug 30th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; while(t--)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. cout.tie(0);
  10. ///!b1@[]
  11. test
  12. {
  13. ll n,c,d,e,f,i,j=0,k=10000000;
  14. ll a[26]={0};
  15. string x;
  16. cin>>n;
  17. k=n;
  18. while(n--)
  19. {
  20. cin>>x;
  21. for(i=0; i<x.size(); i++)
  22. {
  23. a[x[i]-97]++;
  24. }
  25. }
  26. for(i=0; i<26; i++)
  27. {
  28. if(a[i]>0)
  29. {
  30. if(a[i]%k!=0)
  31. {
  32. j=1;
  33. break;
  34. }
  35. }
  36. }
  37. if(j==0) cout<<"YES"<<endl;
  38. else cout<<"NO"<<endl;
  39. }
  40. return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement