#include <iostream>
using namespace std;
void checkunique(string str);
bool first;
int main()
{
string input;
first = true;
//while(cin>>input)
while(getline(cin, input)){
if(first == false)
cout<<endl;
checkunique(input);
first = false;
}
return 0;
}
void checkunique(string str){
int char_set[256] = {0};
for(int i = 0 ; i < str.length() ; i ++){
int val = str[i];
char_set[val]++;
}
for(int i = 1 ; i <= str.length() ; i ++){
for(int j = 256 ; j >= 0 ; j--){
if(char_set[j] == i){
cout<<j<<" "<<i<<endl;
}
}
}
}
Tuesday, February 7, 2012
ACM 10062 -- Tell me the frequencies!
Subscribe to:
Comments (Atom)