Solution

compressing a string