#K32692. Character Frequency Encoding

    ID: 24922 Type: Default 1000ms 256MiB

Character Frequency Encoding

Character Frequency Encoding

Given a string \( s \), your task is to generate a new string where each unique character in \( s \) is immediately followed by its frequency of occurrence in \( s \). The order of characters in the resulting string should be the same as their first appearance in \( s \).

Example:

Input:  aabbccc
Output: a2b2c3

In the example above, the character 'a' appears twice, followed by 'b' which appears twice, and 'c' which appears three times. Notice that although 'a' and 'b' repeat later in the string, they only appear once in the output in the order they first appear.

Note: The input string is read from standard input (stdin) and the output should be printed to standard output (stdout).

inputFormat

The input is a single line containing the string \( s \). You may assume that \( s \) is non-empty and consists only of printable characters.

outputFormat

The output is a single line representing the encoded string as described above.

## sample
aabbccc
a2b2c3