public int ladderLength3(String start, String end, Set<String> dict) {
        queue = new LinkedList<String>();
        queue.add(start);
        dict.add(end);
        int step = 1;
        while(!queue.isEmpty()){
            int count = queue.size();
            for(int j = 0; j < count; j++){
                String s = queue.poll();
                for(int i = 0; i < s.length(); i++){
                    for(char c = 'a'; c <= 'z'; c++){
                        if(c == s.charAt(i)) continue;
                        String tmp = replace(s, i, c);
                        if(tmp.equals(end)){
                            return step + 1;
                        }

                        if(dict.contains(tmp)){
                            queue.add(tmp);
                            dict.remove(tmp);
                        }
                    }
                }
            }
            step++;
        }
        return 0;
    }