Amazon interview question

Solve this leetcode medium problem involving rolling windows on a string.