Happen Bank interview question

Algorithm question: compressing the String. e.g. aaabbb->a3b3