public static void main(String [] args) throws IOException {
//        String start = "hit";
//        String end = "cog";
//        String [] dict = new String[]{"hot","dot","dog","lot","log"};
//        HashSet<String> ds = new HashSet<String>(Arrays.asList(dict));
//
//        long s1 = System.currentTimeMillis();
//        for(int i = 0; i < 1000; ++i) {
////            System.out.println(new Word_Ladder().ladderLength(start, end, ds));
//            new Word_Ladder().ladderLength(start, end, ds);
//        }
//        System.out.println(System.currentTimeMillis() - s1);
//
//        long s2 = System.currentTimeMillis();
//        for(int i = 0; i < 1000; ++i) {
////            System.out.println(new Word_Ladder().ladderLength1(start, end, ds));
//            new Word_Ladder().ladderLength1(start, end, ds);
//        }
//        System.out.println(System.currentTimeMillis() - s2);

        File f = new File("word_ladder.txt");
        BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
        String line = "";
        HashSet<String> ds = new HashSet<String>();
        while((line = reader.readLine()) != null){
            ds.add(line);
        }

        String start = "nanny", end = "aloud";
        long s1 = System.currentTimeMillis();
        System.out.println(new Word_Ladder().ladderLength(start, end, ds));
        System.out.println(System.currentTimeMillis() - s1);

        long s2 = System.currentTimeMillis();
        System.out.println(new Word_Ladder().ladderLength1(start, end, ds));
        System.out.println(System.currentTimeMillis() - s2);

    }