Codeforces 1203D2 Remove the Substring (hard version)

NoSuchKey