Pregunta de entrevista de Barclays

Medium-Hard DSA question on string manipulation and pattern detections