<gouthampradhan>string_LongestWordInDictonary_1.java
public String findLongestWord(String s, List<String> d) {
    Collections.sort(
        d, Comparator.comparing(String::length).reversed().thenComparing(String::compareTo));
    for (String str : d) {
      if (str.length() <= s.length()) {
        int i = 0, j = 0;
        for (int l1 = s.length(), l2 = str.length(); i < l1 && j < l2; ) {
          if (s.charAt(i) == str.charAt(j)) {
            i++;
            j++;
          } else {
            i++;
          }
        }
        if (j >= str.length()) return str;
      }
    }
    return "";
  }
public String var_0 ( String var_2 , List < String > var_4 ) {
  Collections . sort ( var_4 , Comparator . comparing ( String :: length ) . reversed ( ) . thenComparing ( String :: compareTo ) ) ;
  for ( String var_13 : var_4 ) {
    if ( var_13 . length ( ) <= var_2 . length ( ) ) {
      int var_15 = 0 , var_16 = 0 ;
      for ( int var_17 = var_2 . length ( ) , var_18 = var_13 . length ( ) ;
      var_15 < var_17 && var_16 < var_18 ;
      ) {
        if ( var_2 . charAt ( var_15 ) == var_13 . charAt ( var_16 ) ) {
          var_15 ++ ;
          var_16 ++ ;
        }
        else {
          var_15 ++ ;
        }
      }
      if ( var_16 >= var_13 . length ( ) ) return var_13 ;
    }
  }
  return "" ;
}
