#C577. String Compression
String Compression
String Compression
Given a string s, compress it by replacing consecutive identical characters with the character followed by the number of repetitions. For example, if a character c appears consecutively k times, it is replaced by ck (written in LaTeX as \( c_{k} \)).
If the compressed string is not strictly shorter than the original string, return the original string instead.
Note: The compression should only be applied if it results in a string with fewer characters than the input string.
inputFormat
The input consists of a single line containing the string s to be compressed. The string will contain only lowercase English letters.
outputFormat
Output the compressed string if it is shorter than the original; otherwise, output the original string.
## sampleaaabcccccaaa
a3b1c5a3