import java.io.*;import java.util.HashMap;public class EncodingTable {	private HashMap table;		public static void main(String[] args) {		new EncodingTable();	}		public EncodingTable() {		try {			build_name_encoding_table();			FileOutputStream fos = new FileOutputStream("enctbl.ser");			ObjectOutputStream oos = new ObjectOutputStream(fos);			oos.writeObject(table);			oos.close();		}		catch (IOException ioex) {			ioex.printStackTrace();		}	}	private void add_map(HashMap map,String key,int val) {		map.put(key,new Integer(val).toString());	}		private void simple_range(HashMap map,String letter,int start,int stop) {		add_map(table,letter,start);		fill(table,new StringBuffer(letter).append("a").toString(),new StringBuffer(letter).append("z").toString(),start+1,stop);	}		private void fill(HashMap map,String l1,String l2,int n1,int n2) {		String orig_l = l1;		int orig_n = n1;		String last_l = l2;		int last_n = n2;		while (n1 < n2) {			if (table.containsValue(new Integer(n1).toString())) {				n1++;				continue;			}			add_map(table,l1,n1);			last_l = l1;			last_n = n1;			// to next			char[] c = l1.toCharArray();			c[c.length-1] = (char)(((byte)c[c.length-1]) + (byte)1);			l1 = new String(c);			n1++;		}		if (!l1.equals(l2) || n1 != n2) 			throw new IllegalArgumentException(new StringBuffer("Mismatch in range ").append(orig_l).append("-").append(l2).append(" ").append(orig_n).append(" ").append(n2).append(". Ended at ").append(l1).append(", ").append(n1).toString());	}		private void build_name_encoding_table() {		table = new HashMap();		add_map(table,"a",27);		fill(table,"aa","al",28,39);		fill(table,"ala","alz",40,65);		fill(table,"am","az",66,79);		simple_range(table,"b",80,106);		simple_range(table,"c",107,133);		simple_range(table,"d",134,160);		add_map(table,"e",161);		fill(table,"ea","ed",162,165);		add_map(table,"edward",189);		fill(table,"eda","edz",166,192);		fill(table,"ee","el",193,200);		add_map(table,"elizabeth",210);		add_map(table,"ellen",214);		fill(table,"ela","elz",201,228);		fill(table,"em","ez",229,242);		simple_range(table,"f",243,269);		simple_range(table,"g",270,296);		add_map(table,"h",297);		add_map(table,"henry",303);		fill(table,"ha","hz",298,324);		simple_range(table,"i",325,351);		add_map(table,"j",352);		add_map(table,"ja",353);		add_map(table,"james",367);		fill(table,"jaa","jaz",354,380);		fill(table,"jb","je",381,384);		fill(table,"jea","jez",385,410);		fill(table,"jf","jo",411,420);		add_map(table,"john",429);		add_map(table,"joseph",441);		fill(table,"joa","joz",421,448);		fill(table,"jp","jz",449,459);		simple_range(table,"k",460,486);		add_map(table,"l",487);		fill(table,"la","le",488,492);		fill(table,"lea","lez",493,518);		fill(table,"lf","lo",519,528);		fill(table,"loa","loz",529,554);		fill(table,"lp","lz",555,565);		add_map(table,"m",566);		add_map(table,"ma",567);		add_map(table,"margaret",586);		add_map(table,"mary",587);		fill(table,"maa","maz",568,595);		fill(table,"mb","mz",596,620);		simple_range(table,"n",621,647);		simple_range(table,"o",648,674);		simple_range(table,"p",675,701);		simple_range(table,"q",702,728);		add_map(table,"r",729);		add_map(table,"robert",745);		fill(table,"ra","rz",730,756);		simple_range(table,"s",757,783);		simple_range(table,"t",784,810);		simple_range(table,"u",811,837);		simple_range(table,"v",838,864);		add_map(table,"w",865);		fill(table,"wa","wi",866,874);		add_map(table,"william",887);		fill(table,"wia","wiz",875,901);		fill(table,"wj","wz",902,918);		simple_range(table,"x",919,945);		simple_range(table,"y",946,972);		simple_range(table,"z",973,999);	}}