97. compress a string
Share
medium - accepted / - tried
Given a string, compress the repeating letters with count number
compress('a') // 'a'compress('aa') // 'a2'compress('aaa') // 'a3'compress('aaab') // 'a3b'compress('aaabb') // 'a3b2'compress('aaabba') // 'a3b2a'