String Challenge-String Compression

code: https://ide.codingblocks.com/s/108470
what is wrong with above code?(not correct with 2 testcases)

hey @dvitiarora, your approach is not correct, you need to compress contiguous character not total occurance of character. For example: input string=aba than output should be a1b1a1 instead if a2b1.