Sir please check my code

For the testcase :- aabbaa
Your output: a4b2
Correct Output: a2b2a2
You need to compress the string in the order in which alphabets are there in the string