Wrong answer in two test cases string compression problem

Please tell me what is wrong in my code.
Code link :- https://ide.codingblocks.com/s/154016

@raikunal251297 Your code is not handling the last repetition correctly.
For case: aaaabbbb
Expected O/P: a4b4
Your O/P: a4b1

Hope this helps :slightly_smiling_face: