Maslo Consulting Interview Question

Compress the string with out breaking the sequence.