IBM Interview Question

Two string manipulation question on hacker rank