0 String compression using the counts of repeated characters. Input : A string // aaaabbc Output : A string // a4b2c1 Logic : Iterate over the stringCompare the current and next characters.If both characters are not same, Then increment the count by 1 and do string concatenation. Solution : javascript characters compression repeated string Please enable JavaScript to view the comments powered by Disqus.