Whats wrong with my code?

hello @akash_281

u need to compress only consecutive same character.

for example->
aaabbcccb

output should be
a3b2c3b1

check ur updated code here->

@akash_281 Is your doubt resolved ?

Hey @pratyush63 , No actually can you see my code again and point out the mistakes

Your code was giving segmentation fault because of line 13.
Change it to for(int j=i+1;j<n;j++)
Also you are not printing the result in desired format.

for example->
aaabbcccb

output should be
a3b2c3b1