This problem is in Contest(s) below:
Contest 100000580:《算法笔记》3.6小节——入门模拟->字符串处理