Doubt in string compression problem

why are my 2 test cases giving wrong answer?

Plz send your code here by saving in ide

i corrected my mistake .
passed all the test cases.
thank you

Plz mark your doubt as resolved