#C6953. Run-Length Encoding Compression

    ID: 50770 Type: Default 1000ms 256MiB

Run-Length Encoding Compression

Run-Length Encoding Compression

This problem requires you to implement a run-length encoding (RLE) compression algorithm. Given a string s consisting of uppercase letters (A-Z), your task is to compress the string by replacing each group of consecutive identical characters with the character followed by the number of occurrences. The transformation can be mathematically represented as:

\( \text{compress}(s) = \text{For each group } (c, k) \text{, output } c\{k\} \)

For example, the string AAABCCDDDD should be compressed to A3B1C2D4 because there are 3 A's, followed by 1 B, 2 C's, and 4 D's. Your implementation must read the input from stdin and print the result to stdout.

inputFormat

The input consists of a single line containing the string s (only uppercase letters A-Z). It is guaranteed that the string length is at least 1.

outputFormat

Output the compressed string using run-length encoding. For each group of consecutive identical characters, output the character followed immediately by the count of repetitions.

## sample
AAABCCDDDD
A3B1C2D4