Encrypt the string - 2
##### Submissions: 649   Accuracy: 28.38%   Difficulty: Easy   Marks: 2

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 ].

Input:
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

Output:
For each test case, output its encrypted string in a single line.

Constraints
1<=T<=10
|S|<=100000

Example:
Input:

2
aaaaaaaaaaa
abc

Output:
ba
1c1b1a

Explanation
For first test case
aaaaaaaaaaa
Step1: a11
Step2: a11 is ab [since 11 is b in hexadecimal]
Step3: ba

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Vikraman
Author: vikikkdi

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.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.