1.1 Devansh's Secret Code
Devansh Nair was given a secret scroll that contained a string of tiny handwritten letters. To preserve the scroll in shorter form, he decides to write it in a compressed style.
The rule he follows is simple:
Whenever the same letter appears repeatedly one after another, he writes the letter once, followed by the number of times it was repeated in a row.
Even if a letter appears only once, the count 1 must still be written.
The letters must stay in their original order.
Can you help Devansh compress the scroll text?
Constraints
1 ≤ |s| ≤ 10^5
s contains only lowercase English letters (a–z)
Input Format
A single line containing the string s.
Output Format
Print the compressed string
Example 1
Input:
aaabbc
Output:
a3b2c1
Explanation:
-
Example 2
Input:
abcd
Output:
a1b1c1d1
Explanation:
-
Log In to solve the Question