Advertisement
Estera

colegi

Apr 4th, 2020
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. using namespace std;
  4. map<string,int> a;
  5. int n,mx=0;
  6. string s,nume;
  7. int main()
  8. {
  9. cin>>n;
  10. for(int i=1;i<=n;i++)
  11. {
  12. cin>>s;
  13. a[s]++;
  14. if(a[s]>=mx)
  15. {mx=a[s];
  16. nume=s;}
  17. }
  18. cout<<nume<<' '<<mx<<'\n';
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement