#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.size();
map<char,int>m1;
map<int,int>m2;
for(int i = 0;i < n;i++){
m1[s[i]]++;
m2[m1[s[i]]]++;
if(m2[m1[s[i]] - 1] != 0){
m2[m1[s[i]] - 1]--;
}
}
for(auto it = m2.begin();it != m2.end();it++){
cout << it->first << " "<< it->second << endl;
}
return 0;
}