#C8820. Run-Length Encoding

    ID: 52845 Type: Default 1000ms 256MiB

Run-Length Encoding

Run-Length Encoding

Given an input string, perform run-length encoding. In run-length encoding, consecutive occurrences of the same character are replaced by a single instance of that character preceded by the count of its repetitions. For example, the string aaabccddd is encoded as 3a1b2c3d.

Your task is to read a string from standard input (stdin) and output its run-length encoded form to standard output (stdout). The input string will contain only alphabetic characters and will not include any spaces.

Note: If the input string is empty, the encoded output should be an empty string.

inputFormat

The input consists of a single line containing a string. This string can be composed of consecutive alphabetic characters.

Input Format Example:
aaabccddd

outputFormat

Output a single line: the run-length encoded version of the input string. For each group of consecutive identical characters, output the count of those characters followed immediately by the character itself.

Output Format Example:
3a1b2c3d

## sample
a
1a