Advertisement
a53

h4

a53
Oct 25th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <map>
  4. #define NMAX 100001
  5. using namespace std;
  6. string arr[NMAX];
  7. int n;
  8.  
  9. int largestAnagramSet(string arr[],int n)
  10. {
  11. int maxSize=0;
  12. map<vector<int>,int> countc;
  13.  
  14. for (int i=0;i<n;++i)
  15. {
  16. vector<int> freq(26);
  17.  
  18. for(char ch:arr[i])
  19. freq[ch-'a']+=1;
  20. countc[freq]+=1;
  21. maxSize=max(maxSize,countc[freq]);
  22. }
  23. return maxSize;
  24. }
  25.  
  26. int main()
  27. {
  28. while(cin>>arr[n++])
  29. cin.get();
  30. cout<<largestAnagramSet(arr,n);
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement