Scott Logic interview question

Some string manipulation coding questions