Problem 1397 · Hard

Find All Good Strings

Count strings between s1 and s2 that avoid evil by tracking the KMP match length and whether the prefix still ties to either bound.

Open the interactive visualisation