import java.util.*; 
import java.io.*; 

public class WordFrequency4 {
  static public void main(String[] args) {
    Map words = new HashMap(); 
    String delim = " \t\n.,:;?!-/()[]\"\'";
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); 
    String line, word;
    Count count; 
    try {
      while ((line = in.readLine()) != null) {
        StringTokenizer st = new StringTokenizer(line, delim); 
        while (st.hasMoreTokens()) {
          word = st.nextToken().toLowerCase(); 
          count = (Count) words.get(word); 
          if (count == null) {
            words.put(word, new Count(word, 1)); 
          } else {
            count.i++; 
        }
      }
    } 
  } catch (IOException e) {}
    
    List list = new ArrayList(words.values()); 
    Collections.sort(list, new CountComparator()); 
    Iterator iter = list.iterator();

    while (iter.hasNext()) {
      count = (Count) iter.next(); 
      word = count.word;
      System.out.println(word + 
			 (word.length() < 8 ? "\t\t" : "\t") + 
			 count.i); 
    }
  }

  static class Count {
    Count(String word, int i) {
      this.word = word; 
      this.i = i; 
    }

    String word; 
    int i; 
  }

  static class CountComparator implements Comparator {
    public int compare(Object o1, Object o2) {
      if (o1 != null && 
	  o2 != null && 
	  o1 instanceof Count && 
	  o2 instanceof Count) { 
	Count c1 = (Count) o1; 
	Count c2 = (Count) o2; 
	return (c2.i - c1.i); 
      } else {
	return 0; 
      }
    }
  }
}