Faarms interview question

Q: Basic string manipulation question. Level: Easy