Mid test cases failing

Below is the code with a bit of explanation can you please tell me why my test cases arent passing by providing those test cases.

hii. some test cases for which your code is failing are:

  1. aabaa
    the output should be a2b1a2, but yr code is generating output a4b2.
  2. baa
    the output should be b1a2,but yr code is producing a2b1.

Ok, Thanks for the help .

Should I mark it as resolved?