Joseph developed an editing software called Pandote recently, and now he is testing it to make sure it works correctly, otherwise, he will probably get fired!
Joseph starts his testing by implementing copying and pasting as well as reversing operations to the string on the Pandote. More specifically, in each step, if the string on the screen is

, he will do the following operations in order.
- Choose a prefix of length
, then
can be denoted by
. Note that the string
can be empty. - Swap the two parts and get the string
. - Reverse the whole string and get the string
.
However, since the function of Pandote is limited, there are only two different lengths

and

of prefix he can choose in each step. Now Joseph wants to know whether he can convert the string

to

through several (possibly zero) steps.