public static ArrayList<String> restoreIpAddresses(String s) {
		ArrayList<ArrayList<String>> resultLists = new ArrayList<ArrayList<String>>();
		ArrayList<String> result = new ArrayList<String>();
		if (s.length() == 0)
			return result;

		ArrayList<String> list = new ArrayList<String>();
		restoreIpAddressesHelper(s, list, resultLists);
		outerloop: while (resultLists.size() != 0) {
			if (resultLists.get(0).size() == 4) {
				StringBuilder sb = new StringBuilder();
				for (String str : resultLists.get(0)) {
					int i = Integer.parseInt(str);
					if (str.length() != String.valueOf(i).length()) {
						resultLists.remove(0);
						continue outerloop;
					}
					sb.append(str + ".");
				}
				sb.deleteCharAt(sb.length() - 1);
				result.add(sb.toString());
			}
			resultLists.remove(0);
		}
		return result;
	}