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 substring of identical letters is replaced by a single instance of that letter followed by the number of occurences of that letter. Then, the string thus obtained is further encrypted by reversing it.
The first line contains T, the number of test cases. Then T lines follow, each containing a string S ( |S| <= 1000), consisting of lower case English alphabets
For each test case in a new line print the required encrypted string.
Length of each string <=1000
Explanation: For first test case aabc