Tile interview question

there was a string compression problem