String Compression

I am getting one wrong answer.
Here is the code : https://ide.codingblocks.com/s/298459

@anugrahrastogi,
Input:
abbaa
Expected output:
ab2a2

Your output:
a3b2