solution 1.5, compress string