#P16248. [蓝桥杯 2026 省研究生组] 2026 的出现次数
[蓝桥杯 2026 省研究生组] 2026 的出现次数
Problem Description
You are given a string that contains only the digits , , and .
You may perform the following operation any number of times: find a contiguous substring in the string and replace it with .
Your goal is: by performing some operations, make the number of occurrences of the contiguous substring in the final string as large as possible.
Now, output this maximum number of occurrences.
Input Format
Input one line containing a string consisting only of digits , , and .
Output Format
Output one integer, representing the maximum number of occurrences of the contiguous substring in the final string.
2022026
1
2026202202
2
Hint
Constraints
For of the testdata, the length of the string , , satisfies .
For all testdata, the length of the string , , satisfies , and all input characters are restricted to the set .
Translated by ChatGPT 5