IBM interview question

Two string manipulation question on hacker rank