Grant Street Group Interview Question

leet-code easy question, something about manipulate the substring