hey, 2 of the test cases are not passing and the question is bit unclear about when to count the characters consecutive or not …?
LINK - https://ide.codingblocks.com/s/188736
2 Test cases not passing
@vmanav You do not have to sort in this questions.
Consider a test case:
sskkkkkkwaerrtss
Expected Output:
s2k6w1a1e1r2t1s2
Your Output:
a1e1k6r2s4t1w1
Hope this helps 
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.