This problem is in Contest(s) below:
Contest 1017:NOIP模拟
Contest 1139:2022年暑期普及班-字符
Contest 1033:2020秋季基础班打卡题