#!/usr/local/bin/perl

@x = <STDIN>;

foreach $l (@x){
    chomp($l);
    $count{$&}++ while ($l =~ /ぁ/g);
    $count{$&}++ while ($l =~ /あ/g);
    $count{$&}++ while ($l =~ /ぃ/g);
    $count{$&}++ while ($l =~ /い/g);
    $count{$&}++ while ($l =~ /ぅ/g);
    $count{$&}++ while ($l =~ /う/g);
    $count{$&}++ while ($l =~ /ぇ/g);
    $count{$&}++ while ($l =~ /え/g);
    $count{$&}++ while ($l =~ /ぉ/g);
    $count{$&}++ while ($l =~ /お/g);
    $count{$&}++ while ($l =~ /か/g);
    $count{$&}++ while ($l =~ /が/g);
    $count{$&}++ while ($l =~ /き/g);
    $count{$&}++ while ($l =~ /ぎ/g);
    $count{$&}++ while ($l =~ /く/g);
    $count{$&}++ while ($l =~ /ぐ/g);
    $count{$&}++ while ($l =~ /け/g);
    $count{$&}++ while ($l =~ /げ/g);
    $count{$&}++ while ($l =~ /こ/g);
    $count{$&}++ while ($l =~ /ご/g);
    $count{$&}++ while ($l =~ /さ/g);
    $count{$&}++ while ($l =~ /し/g);
    $count{$&}++ while ($l =~ /す/g);
    $count{$&}++ while ($l =~ /せ/g);
    $count{$&}++ while ($l =~ /そ/g);
    $count{$&}++ while ($l =~ /ざ/g);
    $count{$&}++ while ($l =~ /じ/g);
    $count{$&}++ while ($l =~ /ず/g);
    $count{$&}++ while ($l =~ /ぜ/g);
    $count{$&}++ while ($l =~ /ぞ/g);
    $count{$&}++ while ($l =~ /た/g);
    $count{$&}++ while ($l =~ /だ/g);
    $count{$&}++ while ($l =~ /ち/g);
    $count{$&}++ while ($l =~ /ぢ/g);
    $count{$&}++ while ($l =~ /つ/g);
    $count{$&}++ while ($l =~ /っ/g);
    $count{$&}++ while ($l =~ /づ/g);
    $count{$&}++ while ($l =~ /て/g);
    $count{$&}++ while ($l =~ /で/g);
    $count{$&}++ while ($l =~ /と/g);
    $count{$&}++ while ($l =~ /ど/g);
    $count{$&}++ while ($l =~ /な/g);
    $count{$&}++ while ($l =~ /に/g);
    $count{$&}++ while ($l =~ /ぬ/g);
    $count{$&}++ while ($l =~ /ね/g);
    $count{$&}++ while ($l =~ /の/g);
    $count{$&}++ while ($l =~ /は/g);
    $count{$&}++ while ($l =~ /ば/g);
    $count{$&}++ while ($l =~ /ぱ/g);
    $count{$&}++ while ($l =~ /ひ/g);
    $count{$&}++ while ($l =~ /び/g);
    $count{$&}++ while ($l =~ /ぴ/g);
    $count{$&}++ while ($l =~ /ふ/g);
    $count{$&}++ while ($l =~ /ぶ/g);
    $count{$&}++ while ($l =~ /ぷ/g);
    $count{$&}++ while ($l =~ /へ/g);
    $count{$&}++ while ($l =~ /べ/g);
    $count{$&}++ while ($l =~ /ぺ/g);
    $count{$&}++ while ($l =~ /ほ/g);
    $count{$&}++ while ($l =~ /ぼ/g);
    $count{$&}++ while ($l =~ /ぽ/g);
    $count{$&}++ while ($l =~ /ま/g);
    $count{$&}++ while ($l =~ /み/g);
    $count{$&}++ while ($l =~ /む/g);
    $count{$&}++ while ($l =~ /め/g);
    $count{$&}++ while ($l =~ /も/g);
    $count{$&}++ while ($l =~ /や/g);
    $count{$&}++ while ($l =~ /ゃ/g);
    $count{$&}++ while ($l =~ /ゆ/g);
    $count{$&}++ while ($l =~ /ゅ/g);
    $count{$&}++ while ($l =~ /よ/g);
    $count{$&}++ while ($l =~ /ょ/g);
    $count{$&}++ while ($l =~ /ら/g);
    $count{$&}++ while ($l =~ /り/g);
    $count{$&}++ while ($l =~ /る/g);
    $count{$&}++ while ($l =~ /れ/g);
    $count{$&}++ while ($l =~ /ろ/g);
    $count{$&}++ while ($l =~ /ゎ/g);
    $count{$&}++ while ($l =~ /わ/g);
    $count{$&}++ while ($l =~ /を/g);
    $count{$&}++ while ($l =~ /ん/g);
    $count{$&}++ while ($l =~ /ゐ/g);
    $count{$&}++ while ($l =~ /ゑ/g);
    $count{$&}++ while ($l =~ /ー/g);
    $count{$&}++ while ($l =~ /。/g);
}


#ハッシュを数値順にソート
@keys = sort {
   $count{$b} <=> $count{$a} ||
   length($b) <=> length($a) ||
   $a cmp $b
} keys %count;


$i=0;
foreach $a (@keys){
    print "$a $i \n";
    $i++;
}

#foreach $a (@keys){
#    print $a, ": $count{$a}\n";
#}


#foreach $c (keys(%count)) {
#    print $c, ": $count{$c}\n";
#}


