Warner Bros. Discovery interview question

2nd round: 1. Leetcode medium level string problem