Getting only 2nd test case wrong

Que- string compression

here is the code https://ide.codingblocks.com/s/244500

if the character is repeated more than 9 times then, your code gives wrong answer because ‘0’ + 12 is not equal to 10, for example in case aaaaaaaaaaaabb answer should be a12b2, but your answer is a<b2
you dont need to form the solution string you can simply print the answer each time you encounter different element.
Code: