String compression__

what’s wrong in this code.
LINK -
https://ide.codingblocks.com/s/105219.

why two cases are failed.

You are using a wrong approach in your code. Your code fails in such type of test cases :
Input : sskkkkkkwaerrtss
Your Output : s4k6w1a1e1r2t1s4
Expected Output : s2k6w1a1e1r2t1s2

Plz modify your code.