import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;


public class Main {
	public static boolean accept(char truc)
	{
		char[] array = {'$', '/', '~', '[', ']', '^', '=', '-', '|', '$', '\'', '\\', '%', '?', '!', '&', '?', '@', '#', '_', '-', '+', '*', ';', '.'}; 
		if((truc >= '0' && truc<= '9') || (truc >= 'a' && truc<= 'z') || (truc >= 'A' && truc <= 'Z'))
			return true;
		for(char a : array)
		{
			if(truc == a)
				return true;
		}
		return false;
	}
	public static String process(char[] array)
	{
		int i;
		if(array.length == 0)
			return "";
		for(i = array.length-1 ; i > 0 ; i--)
		{
			if(accept(array[i]))
				continue;
			else
			{
				break;
			}
		}
		String todo = "";
		for(int j = i+1 ; j < array.length ; j++)
		{
			todo += array[j];
		}
		if(todo.length() == 1)
		{
			System.out.print(array);
			System.out.println(" aa " + todo);
		}
			return todo;
	}
	static int count = 0;
	public static void main(String[] args) 
	{
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		
		try {
			 BufferedReader br = new BufferedReader(new FileReader(new File("10-million-combos.txt")));
			 String line;
			 while((line = br.readLine()) != null)
			 {
				 String proc = process(line.toCharArray());
				 if(map.containsKey(proc))
					 map.put(proc, map.get(proc)+1);
				 else
					 map.put(proc, 1);
			 }
		} catch (IOException e) 
		{
			e.printStackTrace();
		}
		int total = 100;
		int[] max = new int[total];
		
		String[] memorys = new String[total];
		for(int i = 0 ; i < total ; i++)
		{
			max[i] = 0;
			memorys[i] = "";
		}
		for(String key : map.keySet())
		{
			int value = key.length();
			if(key != "")
			for(int i = 0 ; i < total; i++)
			{
				if(value >= max[i])
				{
					for(int j = total-1 ; j > i ; j--)
					{
						max[j] = max[j-1];
						memorys[j] = memorys[j-1];
					}
					max[i] = value;
					memorys[i] = key;
					break;
				}
			}
		}
		
		for(int i = 0 ; i < total ; i++)
		{
			System.out.println((i+1) + ": " + memorys[i] + " --> " + max[i]);
		}
		System.out.println(count);
	}

}
