public ArrayList<Integer> findSubstring(String S, String[] L) {

        if (L.length == 0) {
            return null;
        }

        int sLength = L[0].length();
        int allsLength = sLength * L.length;

        HashMap<String, Integer> allWords = new HashMap<String, Integer>();

        for (String s : L) {
            if (allWords.containsKey(s)) {
                allWords.put(s, allWords.get(s) + 1);
            } else {
                allWords.put(s, 1);
            }
        }

        int current = 0;
        ArrayList<Integer> result = new ArrayList<Integer>();

        while ((S.length() - current) >= allsLength) {
            if (hitAll(S, current, allWords, sLength)) {
                result.add(current);
            }
            current += 1;
        }

        return result;
    }