Codeforces 1296E2. String Coloring (hard version)

NoSuchKey