Accenture interview question

Asked about strings questions. Easy leet code