Juniper Square interview question

string manipulation question, quite basic