SAP interview question

Leetcode easy question (string manipulation)