<qiyuangong>720_Longest_Word_in_Dictionary_1.java
public String longestWord(String[] words) {
        String ans = "";
        Set<String> wordset = new HashSet();
        for (String word: words) wordset.add(word);
        for (String word: words) {
            if (word.length() > ans.length() ||
                    word.length() == ans.length() && word.compareTo(ans) < 0) {
                boolean good = true;
                for (int k = 1; k < word.length(); ++k) {
                    if (!wordset.contains(word.substring(0, k))) {
                        good = false;
                        break;
                    }
                }
                if (good) ans = word;
            }    
        }
        return ans;
    }
public String var_0 ( String [ ] var_2 ) {
  String var_4 = "" ;
  Set < String > var_7 = new HashSet ( ) ;
  for ( String var_8 : var_2 ) var_7 . add ( var_8 ) ;
  for ( String var_8 : var_2 ) {
    if ( var_8 . length ( ) > var_4 . length ( ) || var_8 . length ( ) == var_4 . length ( ) && var_8 . compareTo ( var_4 ) < 0 ) {
      boolean var_18 = true ;
      for ( int var_15 = 1 ;
      var_15 < var_8 . length ( ) ;
      ++ var_15 ) {
        if ( ! var_7 . contains ( var_8 . substring ( 0 , var_15 ) ) ) {
          var_18 = false ;
          break ;
        }
      }
      if ( var_18 ) var_4 = var_8 ;
    }
  }
  return var_4 ;
}
