document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. #define MIN_ASCII 32
  6. #define MAX_ASCII 130
  7.  
  8. int main()
  9. {
  10.     string str;
  11.     bool blank=0;
  12.     while(cin>>str){
  13.         int ASCII[MAX_ASCII]={0};
  14.         if(blank){
  15.             cout<<endl;
  16.         }
  17.  
  18.         for(int i=0;i<str.length();i++){
  19.             ASCII[ (int)str[i] ] ++;
  20.         }
  21.  
  22.         int maxFrequency=0;
  23.         for(int i=MIN_ASCII;i<MAX_ASCII;i++){
  24.             maxFrequency = (ASCII[i] > maxFrequency)?  ASCII[i] : maxFrequency;
  25.         }
  26.  
  27.         for(int f=1;f<=maxFrequency;f++){
  28.             for(int i=MAX_ASCII;i>=MIN_ASCII;i--){
  29.                 if(f == ASCII[i]){
  30.                     cout<< i <<" "<< f <<endl;
  31.                 }
  32.             }
  33.         }
  34.         blank=1;
  35.     }
  36.  
  37.     return 0;
  38. }
');