STRING COMPRESSION: TWO TEST CASES NOT PASSED

for the input aaabbbaaa your output is a3b3a3, but your output is a6b3a6, so do not keep global count

But in the question it was mentioned that alphabets are repeated consectively

aaa are consecutive. it doesnt mean that alphabets cant occur at different locations consecutively