This problem is in Contest(s) below:
Contest 1056:String
Contest 1504:YC_2021_4月
Contest 1503:各种自动机
Contest 1502:Trie及Ac自动机入门
Contest 1296:字符串入门
Contest 1499:YC_2021_3月