#abc325g. G - offence
G - offence
Score : points
问题描述
你给定一个字符串 。通过在字符串 上执行零次或多次以下操作,找到可以得到的最短字符串长度。
- 在字符串中选择一个连续出现的
of
子串以及一个整数 ,使得 。然后,从字符串中移除这个of
及其后面紧随的 个字符。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a string . Find the minimum length of a string that can be obtained by performing the following operation on the string zero or more times.
- Choose a contiguous occurrence of
of
in the string and an integer between and , inclusive. Then, remove theof
and the following characters from the string.
Constraints
- is an integer.
- is a string consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
keyofscience
3
Sample Output 1
7
By choosing the of
formed by the fourth and fifth characters and setting , you can remove ofsci
from keyofscience
and get keyence
.
It is impossible to reduce the length of the string to or less by repeating the operation, so the answer is .
Sample Input 2
oofsifffence
3
Sample Output 2
2
Sample Input 3
ooofff
5
Sample Output 3
0
Sample Input 4
okeyencef
4
Sample Output 4
9
update @ 2024/3/10 01:48:46