//Tell me the frequencies!
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
char c[1000];
while(fgets(c, sizeof(c), stdin)){
int a[128]={0};
int first;
for(int i = 0; c[i]!='\0'; i++){
for(int j = 32; j<=127; j++){
if(c[i]==j){
a[j] = a[j]+1;
}
}
}
int chars[128], count = 0;
for(int k=32; k<128; k++){
if(a[k]>0){
chars[count++]=k;
}
}
for(int i = 0;i<count;i++){
for(int j=0;j<count-1-i;j++){
if(a[chars[j]]>a[chars[j+1]] || (a[chars[j]]==a[chars[j+1]] && chars[j]<chars[j+1])){
int temp = chars[j];
chars[j]=chars[j+1];
chars[j+1]=temp;
}
}
}
for(int i =0;i<count;i++){
printf("%d %d\n",chars[i],a[chars[i]]);
}
if(!first)printf("\n");
first = 0;
}
return 0;
}