#C1842. String Compression

    ID: 45092 Type: Default 1000ms 256MiB

String Compression

String Compression

You are given a string S consisting of lowercase letters. Your task is to compress the string by replacing contiguous substrings of repeated characters with a single occurrence of that character followed by the number of repetitions. Formally, if the input string is S with length n, and a character c repeats consecutively k times, then it should be replaced by c followed by k (written in decimal). If the compressed string is not strictly shorter than the original string, output the original string instead.

Note: The count is only appended if it is greater than 1. For example, if S = aabcccccaaa, the compressed string will be a2bc5a3; however, if S = abcd then the output should be abcd because the compressed version would not be shorter.

The condition can be written in LaTeX as follows:

compressed(S)<S|compressed(S)| < |S|

If the condition above is not met, output the original string S.

inputFormat

The input is provided via standard input (stdin) and consists of a single line containing the string S. The string can be empty and consists of lowercase letters only.

outputFormat

Print the compressed form of the input string to standard output (stdout). If the compressed form is not shorter than the original string, print the original string instead.

## sample
aabcccccaaa
a2bc5a3