1. 
/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #10062 - Tell me the frequencies!
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=12&problem=1003&mosmsg=Submission+received+with+ID+7070768
*
* @author Andre Wolfram
* @author Christoph Miesel
* @author Robert Seilbeck
* @version 1.321, 04/15/2009
*
* Status : Accepted
* Runtime 0.120
*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;


public class Name10062 {

private static HashMap<Character,Integer> map;
private static boolean firstTime=true;

public static void main(String[] args) throws IOException {


BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String line;
while((line=reader.readLine())!=null){
//Zeile Einlesen und Buchstaben zählen
map=new HashMap<Character,Integer>();

for(int n=0; n<line.length();n++){
char c=line.charAt(n);
Integer counter=map.get(c);
if (map.get(c) == null) {
map.put(c, 1);
} else {
map.put(c, counter+ 1);
}
}

//In ArrayList konvertieren
ArrayList <Character>result=new ArrayList<Character>();
Iterator <Character> keys=map.keySet().iterator();
while(keys.hasNext()){
Character key=keys.next();
result.add(key);
}
//Buchstaben sortieren
Collections.sort(result,new Comparator<Character>(){


@Override
public int compare(Character o1, Character o2) {
int returnValue=map.get(o1)-map.get(o2);
if(returnValue==0){
return o2-o1;
}
return returnValue;
}

});
if(!firstTime){
System.out.println();
}else{
firstTime=false;
}
for(char c:result){
System.out.println((int)c+" "+map.get(c));
}

}

}
}