DEV Community

Discussion on: String Compression

Collapse
 
codewithml profile image
CodeWithML

I could do something like if count is more than 2 than add the character with count, if count is 1, than only add the character , and lastly if count is exactly 2, then add the character 2 times, so it would remain same as original string.