Because Bessie is bored of playing with her usual text string where the only characters are 'C,' 'O,' and 'W,' Farmer John gave her $Q$ new strings $(1≤Q≤100)$, where the only characters are 'M' and 'O.' Bessie's favorite word out of the characters 'M' and 'O' is obviously "MOO," so she wants to turn each of the Q strings into "MOO" using the following operations:
The first line of input contains the value of $Q$.
The next $Q$ lines of input each consist of a string, each of its characters either 'M' or 'O'. Each string has at least $1$ and at most $100$ characters.
Output the answer for each input string on a separate line.
A sequence of 4 operations transforming the first string into "MOO" is as follows:
Replace the last character with O (operation 1)
Delete the first character (operation 2)
Delete the first character (operation 2)
Delete the first character (operation 2)
The second string cannot be transformed into "MOO." The third string is already "MOO," so no operations need to be performed.