Cannot figure out one case

Hi @abhinavsehgal802_270a44594b6dc4ad

Try running your code for input :- aaaaassssddddffaaagggssfffgzx
Your output :- a8d4f5g4s6xz
expected output :- a5s4d4f2a3g3s2f3gzx

Think on this and your problem will be solved and if you still face any issue please let me know.