Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define REP(i,n) for(int i=0; i<(n); i++)
  4. #define REP2(i,x,n) for(int i=x; i<(n); i++)
  5. #define ALL(n) begin(n),end(n)
  6. struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
  7. int main()
  8. {
  9. string S;
  10. vector<string> vc;
  11. map<string, int> cnt;
  12. while( cin >> S ){
  13. vc.emplace_back( S );
  14. cnt[ S ]++;
  15. }
  16. int MAX{}, MAX2{};
  17. string res, res2;
  18. for( const auto &x: cnt )
  19. {
  20. if( MAX < x.second )
  21. {
  22. MAX = x.second;
  23. res = x.first;
  24. }
  25. if( MAX2 < (int)(x.first).size() )
  26. {
  27. MAX2 = (int)(x.first).size();
  28. res2 = x.first;
  29. }
  30. }
  31. cout << res << " " << res2 << endl;
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement