Hide

Problem G
Head Guard

You are the Head guard at the Royal Blue Mountain Castle.

Your job is simple: take a tally of how many types of critters came through which doors, and in what order.

The castle is renowned for its numerous doors, however sometimes they may or may not be open.

Input

The input consists of $1$ to $15$ lines. Each line contains a string of $1$ to $500$ lowercase English letters.

Output

On each line output the number of characters that went through in a row, formatted as a number immediately followed by the character. For example, if we have the string “aaaabb” this becomes “4a2b”. If the same character appears twice such as in “aaabbaaa” then you do not combine this to become “6a2b”: since the order is important to the guards, we must keep it as “3a2b3a”.

Sample Input 1 Sample Output 1
aaaaabbbccddeee
kklllmmnnnnn
aaaabb
aaabbaaa
aaabbzzzzzzoiousssslllwwwkppdddmnnnnnnnnnnnnnnnppppqq
5a3b2c2d3e
2k3l2m5n
4a2b
3a2b3a
3a2b6z1o1i1o1u4s3l3w1k2p3d1m15n4p2q

Please log in to submit a solution to this problem

Log in