using System; using System.IO; using System.Linq; using System.Collections.Generic; namespace wp { class wp { public static void Main(string[] args) { using(StreamReader sr = new StreamReader(Console.OpenStandardInput())) { Dictionary dict = new Dictionary(); while(sr.Peek() >= 0){ foreach(string word in sr.ReadLine().Split(' ')){ if(dict.ContainsKey(word)){ dict[word]++; }else{ dict.Add(word, 1); } } } foreach(KeyValuePair entry in dict.OrderByDescending(d=>d.Value)){ Console.WriteLine(entry.Value + " " + entry.Key); } } } } }