void dfs(List<List<String>> ladders, List<String> path, String start,
             String end, Map<String, Integer> distance,
             Map<String, List<String>> map) {
        path.add(start);
        if (start.equals(end)) {
            ladders.add(new ArrayList<String>(path));
        } else {
            for (String next : map.get(start)) {
                if (distance.containsKey(next) && distance.get(start) + 1 == distance.get(next)) {
                    dfs(ladders, path, next, end, distance, map);
                }
            }
        }
        path.remove(path.size() - 1);
    }