At Dropbox, you are asked to implement a lightweight string compressor using run-length encoding. Given a string s, compress consecutive repeated characters so that each group becomes the character followed by its count, then return whichever is shorter: the compressed string or the original string.
scharacter + countExample 1
s = "aaabb""a3b2"aaa and bb, so the compressed form is a3b2, which is shorter than aaabb.Example 2
s = "abc""abc"a1b1c1, which is longer than the original string.0 <= len(s) <= 10^5s may contain uppercase letters, lowercase letters, digits, spaces, or symbols