String compression

Take as input S, a string. Write a function that does basic string compression. Print the value returned. E.g. for input “aaabbccds” print out a3b2c2ds

one test case failing .

tried different but test case 1 still failing

resolved the problem