public void dfs(String s, String tmp, ArrayList<String> res, int count) {
        //have 4 parts. if count is 3, means have 3 parts valid already. check the rest, if valid, return.
        //if not, do nothing and back track
        if (count == 3 && isValid(s)) {
            res.add(tmp + s);
            return;
        }
        //for loop, go and check all the possible
        for (int i = 1; i < 4 && i < s.length(); i++) {
            //get the current subString
            String substr = s.substring(0, i);
            if (isValid(substr)) {
                //check the rest of string, pass the current subString with the temp and '.'
                dfs(s.substring(i), tmp + substr + '.', res, count + 1);
            }
        }
    }