Grant Street Group interview question

leet-code easy question, something about manipulate the substring