Codeforces Round #545 (Div. 2) D 贪心 + kmp

NoSuchKey