public int ladderLength(String start, String end, Set<String> dict) {
		if (start.equals(end))
			return 0;
		Queue<String> queue = new LinkedList<String>();
		queue.add(start);
		int level = 0;
		while (!queue.isEmpty()) {
			int size = queue.size();
			for (int i = 0; i < size; i++) {
				String cur = queue.remove();
				if (cur.equals(end)) {
					return level + 1;
				}
				for (int j = 0; j < cur.length(); j++) {
					char[] word = cur.toCharArray();
					for (char ch = 'a'; ch < 'z'; ch++) {
						word[j] = ch;
						String check = new String(word);
						if (!check.equals(cur) && dict.contains(check)) {
							queue.add(check);
							dict.remove(check);
						}
					}
				}
			}
			level++;
		}
		return 0;
	}