Capital One interview question

Code signal standard problems with string and array manipulation