Apexon interview question

Coding exercise on string on coderpad