Miller Thomson interview question

Write the program aabbccc and output should be a2b2c3