boolean headMatch(String s, int fromIndex, String p) {
        if (s.length() < fromIndex + p.length() || fromIndex < 0)
            return false;
        for (int i = 0; i < p.length(); i++) {
            if (p.charAt(i) != '?'
                    && p.charAt(i) != s.charAt(i + fromIndex))
                return false;
        }

        return true;
    }