fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(false);
  8. int n,m;
  9. cin>>n;
  10. for(int i=0;i<n;i++){
  11.  
  12. cin>>m;
  13. string * tab = new string[m];
  14.  
  15. for(int e=0;e<m;e++){
  16.  
  17. string s;
  18. cin>>s;
  19. sort(s.begin(),s.end());
  20. tab[e] = s;
  21.  
  22. }
  23.  
  24. int maxi=0,x=0;
  25.  
  26. for(int e=0;e<m;e++){
  27. for(int r = 0;r<m;r++){
  28. if(tab[e] == tab[r]) x++;
  29.  
  30. if(x> maxi) maxi = x;
  31. }
  32. x = 0;
  33. }
  34.  
  35. cout<<maxi<<endl;
  36.  
  37. delete [] tab;
  38. }
  39. return 0;
  40. }
  41.  
Success #stdin #stdout 0s 15240KB
stdin
1
5
KA
RAKA
KRAK
AKR
KARA
stdout
2