Question d’entretien chez MSC Technologies

Write a java code to count string occurence: Input: aabbbccccaabb Output: a2b3c4a2b2