#K55582. Run-Length Encoding Variant

    ID: 30007 Type: Default 1000ms 256MiB

Run-Length Encoding Variant

Run-Length Encoding Variant

This problem requires you to implement a simple variant of the run-length encoding (RLE) algorithm. Given an input string, replace each sequence of consecutive identical characters with the character followed by the number of times it appears consecutively. However, if a character appears only once, it should be output without a trailing number.

For example, the string aabbc should be encoded as a2b2c and abcd should remain abcd. Make sure your program reads from standard input (stdin) and outputs the results to standard output (stdout).

The encoding rule can be formally described as follows:

For a string \( s \) with length \( n \), traverse the string and count the number of consecutive occurrences of the same character. If the count exceeds \( 1 \), append the character and the count in \( \LaTeX \) format as {character}{count}; otherwise, just append the character itself.

inputFormat

The input consists of a single line containing a non-empty string \( s \) which needs to be encoded using the run-length encoding variant. The input is read from standard input.

outputFormat

The output is the encoded string, generated according to the rule described above. The result should be printed to standard output.

## sample
aabbc
a2b2c