<awangdev>720. Longest Word in Dictionary_1.java
public String longestWord(String[] words) {
        if (words == null || words.length == 0) {
            return null;
        }
        String result = "";
        Arrays.sort(words);
        
        Set<String> set = new HashSet<>();
        set.add(result);
        
        for (String word : words) {
            if (set.contains(word.substring(0, word.length() - 1))) {
                if (word.length() > result.length()) {
                    result = word;    
                }
                set.add(word);
            }
        }
        
        return result;
    }
public String var_0 ( String [ ] var_2 ) {
  if ( var_2 == null || var_2 . length == 0 ) {
    return null ;
  }
  String var_7 = "" ;
  Arrays . sort ( var_2 ) ;
  Set < String > var_12 = new HashSet < > ( ) ;
  var_12 . add ( var_7 ) ;
  for ( String var_14 : var_2 ) {
    if ( var_12 . contains ( var_14 . substring ( 0 , var_14 . length ( ) - 1 ) ) ) {
      if ( var_14 . length ( ) > var_7 . length ( ) ) {
        var_7 = var_14 ;
      }
      var_12 . add ( var_14 ) ;
    }
  }
  return var_7 ;
}
