Bingu was testing all the strings he had at his place, and found that most of them were prone to vicious attack by Banju, his arch enemy. Bingu decided to encrypt all the strings he had, by the following method :
Every sub-string of identical letters is replaced by a single instance of that letter followed by the hexadecimal representation of the number of occurences of that letter. Then, the string thus obtained is further encrypted by reversing it [ See the sample for more clarity ].
The first line contains an integer T, denoting the number of test cases. Then T test cases follow Each containing a string S ( |S| <= 100000), consisting of lower case English alphabets
For each test case, output its encrypted string in a single line.
For first test case
Step2: a11 is ab [since 11 is b in hexadecimal]
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.