## Editorial for IOI '18 P1 - Combo

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Let be the number of asks.

• Ask all possible strings until is returned.

• Determine the characters of from the beginning one by one.
• For each position, try all four characters one by one.

or

• Determine the characters of from the beginning one by one.
• For the first position, determine the character by three asks. For each position except the first one, considering the constraint of , determine the character by two asks.
• Or for each position, using conditional branches, determine the character by two asks.

• Determine the characters of from the beginning one by one.
• Except for the first or last position, determine the character by one ask as follows.
• Assume that the first character of is, for example, A.
• Let be the prefix of already known.
• If the next character is B, then is returned. If it is X, then is returned. If it is Y, then is returned.