<awangdev>Word Ladder II_1.java
public void DFS(String start, String str, Map<String, Integer> distance, Map<String, ArrayList<String>> pastMap, ArrayList<String> path, List<List<String>> rst) {
        path.add(str);
        if (str.equals(start)) {
            Collections.reverse(path);
            rst.add(new ArrayList<String>(path));
            Collections.reverse(path);
        } else {
            for (String s : pastMap.get(str)) {
                if (distance.containsKey(s) && distance.get(str) == distance.get(s) + 1) {
                    DFS(start, s, distance, pastMap, path, rst);
                }
            }
        }
        path.remove(path.size() - 1);
    }
public void sample_funcname ( String start , String str , Map < String , Integer > distance , Map < String , ArrayList < String >> pastMap , ArrayList < String > path , List < List < String >> rst ) {
  path . add ( str ) ;
  if ( str . equals ( start ) ) {
    Collections . reverse ( path ) ;
    rst . add ( new ArrayList < String > ( path ) ) ;
    Collections . reverse ( path ) ;
  }
  else {
    for ( String s : pastMap . get ( str ) ) {
      if ( distance . containsKey ( s ) && distance . get ( str ) == distance . get ( s ) + 1 ) {
        DFS ( start , s , distance , pastMap , path , rst ) ;
      }
    }
  }
  path . remove ( path . size ( ) - 1 ) ;
}
