Minimum Time to Revert Word to Initial State II
Use the Z-function to test in constant time whether the word after t seconds still starts with the original word.
Use the Z-function to test in constant time whether the word after t seconds still starts with the original word.