Bjak Interview Question

Was asked a string manipulation problem,