<awangdev>720. Longest Word in Dictionary_2.java
private ArrayList<String> matchWords(ArrayList<String> wordList) {

        int maxWordLength = Integer.MIN_VALUE;
        ArrayList<String> result = new ArrayList<>();
        for (int i = wordList.size() - 1; i >= 0; i--) {
            String word = wordList.get(i);
            while(word.length() != 0) {
                if (wordList.contains(word)) {
                    if (word.length() == 1) {
                        if (wordList.get(i).length() < maxWordLength) {
                            return result;
                        } else {
                            result.add(wordList.get(i));
                            maxWordLength = wordList.get(i).length();
                        }
                    }
                    word = word.substring(0, word.length() - 1);
                } else {
                    break;
                }
            }
        }
        return result;
    }
private ArrayList < String > var_1 ( ArrayList < String > var_3 ) {
  int var_6 = Integer . MIN_VALUE ;
  ArrayList < String > var_7 = new ArrayList < > ( ) ;
  for ( int var_10 = var_3 . size ( ) - 1 ;
  var_10 >= 0 ;
  var_10 -- ) {
    String var_13 = var_3 . get ( var_10 ) ;
    while ( var_13 . length ( ) != 0 ) {
      if ( var_3 . contains ( var_13 ) ) {
        if ( var_13 . length ( ) == 1 ) {
          if ( var_3 . get ( var_10 ) . length ( ) < var_6 ) {
            return var_7 ;
          }
          else {
            var_7 . add ( var_3 . get ( var_10 ) ) ;
            var_6 = var_3 . get ( var_10 ) . length ( ) ;
          }
        }
        var_13 = var_13 . substring ( 0 , var_13 . length ( ) - 1 ) ;
      }
      else {
        break ;
      }
    }
  }
  return var_7 ;
}
