public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new FileReader("cryptcow.in"));
        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("cryptcow.out")));
        
        message = f.readLine();
        
        boolean pos = true;
        // rule out impossible cases
        for(int i=0; i<original.length(); i++) {
        	if(numOccurs(original, original.charAt(i)) != numOccurs(message, original.charAt(i))) {
        		pos = false;
        		System.out.println("different char frequencies");
        		out.write("0 0\n");
        	}
        }
        if(numOccurs(message, 'C')!=numOccurs(message, 'O') || numOccurs(message, 'C')!=numOccurs(message, 'W')) {
        	pos = false;
        	System.out.println("different number of C/O/W");
        	out.write("0 0\n");
        }
        // calculate hash of subsequences of original
        for(int i=0; i<original.length(); i++) {
        	for(int j=i+2; j<original.length(); j++) {
        		subs.add(original.substring(i, j).hashCode());
        	}
        }
        //System.out.println(test);
        if(!passBasic(message)) {
        	pos = false;
        	out.write("0 0\n");
        }
        // otherwise try to decrypt

        if(pos) {
        	int d = numOccurs(message, 'C');
        	boolean result = decrypt(message, d);
        	if(result) { out.write("1 " + d + "\n"); }
        	else { out.write("0 0\n"); }
        }
        out.close();
        System.exit(0);
    }