Trik2
Jealous of Mirko's position as head of the village, Borko stormed into his tent and tried to demonstrate Mirko's incompetence for leadership with a trick. Borko puts three opaque cups onto the table next to each other (opening facing down) and a small ball under the leftmost cup. He then swaps two cups in one of three possible ways a number of times. Mirko has to tell which cup the ball ends up under. 
InputThe first and only line contains a string of at most 50 characters, Borko's moves. Each of the characters is 'A', 'B' or 'C' (without quote marks).
OutputOutput the index of the cup under which the ball is: 1 if it is under the left cup, 2 if it is under the middle cup or 3 if it is under the right cup.
Input
Output
AB Output
3Input
Output
CBABCACCC Output
1Submit solution
Sign in to submit a solution.