Implement a method to perform string compression using the counts of repeated characters. If the “compressed” string would not become smaller than the original, return the original string.
Assume that the string has only upper and lower case letters (a-z
)
Example
1
2
Input: aabcccccaaa
Output: a2b1c5a3