Bjak interview question

Was asked a string manipulation problem,