<gouthampradhan>hashing_SubstringConcatenationOfWords_1.java
public List<Integer> findSubstring(String s, String[] words) {
    if (words.length == 0) return new ArrayList<>();
    int wLen = words[0].length();
    int sLen = wLen * words.length;
    List<Integer> result = new ArrayList<>();
    if (sLen > s.length()) return result;
    Map<String, Integer> countMap = new HashMap<>();
    for (String w : words) {
      countMap.putIfAbsent(w, 0);
      countMap.put(w, countMap.get(w) + 1);
    }
    for (int k = 0; (s.length() - k) >= sLen; k++) {
      Map<String, Integer> subSMap = new HashMap<>();
      int i = k;
      for (int j = i + wLen; (i - k) < sLen; i = j, j += wLen) {
        String subS = s.substring(i, j);
        subSMap.putIfAbsent(subS, 0);
        subSMap.put(subS, subSMap.get(subS) + 1);
        if (!countMap.containsKey(subS) || subSMap.get(subS) > countMap.get(subS)) {
          break;
        }
      }
      if ((i - k) >= sLen) {
        result.add(k);
      }
    }
    return result;
  }
public List < Integer > var_1 ( String var_3 , String [ ] var_4 ) {
  if ( var_4 . length == 0 ) return new ArrayList < > ( ) ;
  int var_8 = var_4 [ 0 ] . length ( ) ;
  int var_9 = var_8 * var_4 . length ;
  List < Integer > var_11 = new ArrayList < > ( ) ;
  if ( var_9 > var_3 . length ( ) ) return var_11 ;
  Map < String , Integer > var_14 = new HashMap < > ( ) ;
  for ( String var_15 : var_4 ) {
    var_14 . putIfAbsent ( var_15 , 0 ) ;
    var_14 . put ( var_15 , var_14 . get ( var_15 ) + 1 ) ;
  }
  for ( int var_20 = 0 ;
  ( var_3 . length ( ) - var_20 ) >= var_9 ;
  var_20 ++ ) {
    Map < String , Integer > var_21 = new HashMap < > ( ) ;
    int var_22 = var_20 ;
    for ( int var_23 = var_22 + var_8 ;
    ( var_22 - var_20 ) < var_9 ;
    var_22 = var_23 , var_23 += var_8 ) {
      String var_25 = var_3 . substring ( var_22 , var_23 ) ;
      var_21 . putIfAbsent ( var_25 , 0 ) ;
      var_21 . put ( var_25 , var_21 . get ( var_25 ) + 1 ) ;
      if ( ! var_14 . containsKey ( var_25 ) || var_21 . get ( var_25 ) > var_14 . get ( var_25 ) ) {
        break ;
      }
    }
    if ( ( var_22 - var_20 ) >= var_9 ) {
      var_11 . add ( var_20 ) ;
    }
  }
  return var_11 ;
}
