Pergunta de entrevista da empresa Yandex

Write a string compression algorithm like RLE Input: AAABBBCDDDD Output: A4B3CD4