Goldman Sachs interview question

CodePad: Compress strings like "aaabbbcc", "aabb", etc. to "a3b3c2", "a2b2", etc.