private boolean wordBreakHelper(final String s, final Set<String> dict, final int start) {
        final int len = s.length();
        // reach the end of string s
        if (start == len) {
            return true;
        }

        // loop through all strings in dict
        for (final String a : dict) {
            final int end = start + a.length();

            // end index of the dict string should be <= string length in order to compare
            if (end > len) {
                continue;
            }

            if (s.substring(start, end).equals(a)) {
                if (wordBreakHelper(s, dict, end)) {
                    return true;
                }
            }
        }

        return false;
    }