public void visit(String str, int start, int dot){
    	int low = (3 - dot) * 1, high = (3 - dot) * 3;
    	for(int i = 1; i <= 3; i++){
    		if(!(start + i + low <= s.length() && start + i + high >= s.length())) continue;
    		int end = start + i;
    		String sub = s.substring(start, end);
    		if(isLegal(sub)){
    			if(dot == 2){
    				String sub2 = s.substring(end, s.length());
    				if(isLegal(sub2)){
    					res.add(str + sub + "." + sub2);
    				}
    			} else
    				visit(str + sub + ".", end, dot + 1);
    		}
    	}
    }