public int findSol(){
        int[] res = new int[s.length() + 1];
    	for(int i = 0; i <= s.length(); i++) res[i] = i;
    	for(int i = 0; i < s.length(); i++){
    		ArrayList<Integer> pair = pairs.get(i);
    		for(int j = 0; j < pair.size(); j++){
    			int end = pair.get(j);
    			if(res[end+1] > res[i]) res[end+1] = res[i]+1;
    		}
    	}
    	return res[s.length()] - 1;
    }