Recent actions

how write input for like that format.

? 1232 ! 3224

here is my code:

int main(int argc, char ** argv){
	registerInteraction(argc, argv);
	int n = inf.readInt();	// chosen integer
	cout.flush();
	string ch=to_string(n);
	int left = 20;
	bool found = false;
	while(left > 0 && !found){
		left --;
		char ss = ouf.readToken("?|!")[0];
		string cur=ouf.readToken("[0-9][0-9]{3}");
		if(ss=='!'){
		    if(ch==cur){
		        found=true;
		    }
		    break;
		}
		int cnt=0;
		for(int i=0;i<4;i++){
		    if(ch[i]==cur[i]) cnt++;
		}
		cout << cnt << endl;
        fflush(stdout);
	}
	if(!found)
		quitf(_wa, "couldn't guess the number with 20 questions");
	ouf.readEof();
	quitf(_ok, "guessed the number with %d questions!", 20-left);

}
Created or updated the text