private static int convertLetterToNum(String str){
			
		char[] ls = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
		Map<Character, Integer> m = new HashMap<Character, Integer>();
		int j = 1;
		 
		for(char c: ls) {
			m.put(c, j++);
		}
		
		int i = 0;
		int mul = 1;
		
		for(char c: new StringBuffer(str).reverse().toString().toCharArray()) {
			i += m.get(c) * mul;
			mul *= ls.length;
		}
		
		return i;	
	}