private void search(String s, int begin, ArrayList<Integer> solution,
                ArrayList<String> solutions) {
            if (begin == s.length() && solution.size() == 4) {
                solutions.add(toAddr(solution));
                return;
            }
            if (s.length() - begin > (4 - solution.size()) * 3) {
                return;
            }
            if (s.length() - begin < 4 - solution.size()) {
                return;
            }
            int num = 0;
            for (int i = begin; i < Math.min(begin + 3, s.length()); i++) {
                num = num * 10 + s.charAt(i) - '0';
                if (num < 256) {
                    solution.add(num);
                    search(s, i + 1, solution, solutions);
                    solution.remove(solution.size() - 1);
                }
                if (num == 0) {
                    break;
                }
            }
        }