Barclays Interview Question

Medium-Hard DSA question on string manipulation and pattern detections