fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. #include <algorithm>
  5. #include <cmath>
  6. using namespace std;
  7.  
  8.  
  9. int main(void)
  10. {
  11. string sentence;
  12. getline(cin, sentence);
  13. int alphabet[26] = { 0 };
  14. int temp[26] = { 0 };
  15. for (int i = 0; sentence[i] !='\0'; i++)
  16. {
  17. if (sentence[i] != ' ')
  18. {
  19. alphabet[sentence[i] - 'a']++;
  20. temp[sentence[i] - 'a']++;
  21. }
  22. }
  23. sort(alphabet, alphabet + 26);
  24. for(int k = 0; k < 26; k++)
  25. {
  26. if (temp[k] == alphabet[25])
  27. cout << char(k + 'a');
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 4532KB
stdin
english is a west germanic
language originating in england
and is the first language for
most people in the united
kingdom the united states
canada australia new zealand
ireland and the anglophone
caribbean it is used
extensively as a second
language and as an official
language throughout the world
especially in common wealth
countries and in many
international organizations
stdout
eis