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 SSS, he will do the following operations in order. Choose a prefix of length ll ~ l, then SSS can be denoted by ABAB~AB. Note that the string BBB can be empty. Swap the two parts and get the string BABABA. Reverse the whole string and get the string r^rr. However, since the function of Pandote is limited, there are only two different lengths l1l_1l1 and l2l_2l2 of prefix he can choose in each step. Now Joseph wants to know whether he can convert the string SSS to TTT through several steps.
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 SSS, he will do the following operations in order. Choose a prefix of length l (1≤l≤∣S∣)l ~ (1 leq l leq |S|)l (1≤l≤∣S∣), then SSS can be denoted by AB (∣A∣=l)AB~(|A|=l)AB (∣A∣=l). Note that the string BBB can be empty. Swap the two parts and get the string BABABA. Reverse the whole string and get the string (BA)r(BA)^r(BA)r. However, since the function of Pandote is limited, there are only two different lengths l1l_1l1 and l2l_2l2 of prefix he can choose in each step. Now Joseph wants to know whether he can convert the string SSS to TTT through several (possibly zero) steps.