Advertisement
Guest User

Dictionary-1

a guest
Dec 11th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.   char c=' ', ch;
  6.   map<char, int> d;
  7.   do {
  8.     cin >> ch;
  9.     ch = toupper(ch);
  10.     if ('A' <= ch && ch <= 'Z')
  11.     {
  12.       d[ch]++;
  13.       if ( d[c] < d[ch] || (d[c] == d[ch] && ch < c) )
  14.         c = ch;
  15.     }
  16.   } while (ch != '.');
  17.   cout << c << " " << d[c];
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement