#K85682. String Compression
String Compression
String Compression
You are given a string s. Your task is to compress the string by replacing sequences of consecutive repeated characters with the character followed by the number of occurrences. Formally, if a character c appears consecutively k times, it should be replaced by c\(k\)
(where the count is in LaTeX formatted numeral). However, you should output the compressed string only if its length is strictly less than the original string, otherwise, output the original string.
For example, the string "aabcccccaaa" should be compressed to "a2b1c5a3".
inputFormat
The input consists of a single line string s (which may include any printable characters). Read from the standard input.
outputFormat
Output a single string which is the compressed version if its length is strictly less than the original string; otherwise, output the original string. Write the result to standard output.
## sampleaabcccccaaa
a2b1c5a3