This problem is in Contest(s) below:
Contest 1069:2023-WE 百题大战09:递归、迭代法和结构体
Contest 1036:Python-第4章-字符串
Contest 1073:Python初中级-APTIV-C-字符串