Capgemini interview question

Write a program to get the following output - Input - "aabbbcccc" Output - "a2b3c4"