#C14309. String Compression

    ID: 43944 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 groups of consecutive identical characters with the character followed by the count if the count is greater than 1. The compressed string is returned only if its length is strictly less than the original string; otherwise, the original string is returned.

For example, given the string aaabbccccd, the compressed version is a3b2c4d (since the groups are 'aaa', 'bb', 'cccc', and 'd'). Similarly, if the string is abcd, no compression is applied because each character appears only once and the compressed string would not be shorter than the original.

Formally, if you denote the original string by s with length \( n \) and the compressed string by c, then the returned value is given by:

[ \text{result}(s)=\begin{cases} c, & \text{if } |c| < n,\ s, & \text{otherwise.} \end{cases} ]

Your solution should read input from standard input (stdin) and output the result to standard output (stdout).

inputFormat

The input consists of a single line containing the string s to be compressed. The string may be empty.

outputFormat

Output a single line containing the compressed string if its length is strictly less than the original. Otherwise, output the original string.

## sample
aaabbccccd
a3b2c4d