キーエンスプログラミングコンテスト2023秋(AtCoder Beginner Contest 325)
翻译中…
Problem Statement
翻译中…
You are given a string $S$. Find the minimum length of a string that can be obtained by performing the following operation on the string $S$ zero or more times.
翻译中…
- Choose a contiguous occurrence of
ofin the string and an integer$i$between$0$and$K$, inclusive. Then, remove theofand the following$i$characters from the string.
翻译中…
Constraints
翻译中…
$0 \leq K < |S| \leq 300$$K$is an integer.$S$is a string consisting of lowercase English letters.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
S
K
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
keyofscience
3
Output #1
7
By choosing the `of` formed by the fourth and fifth characters and setting $i = 3$, you can remove `ofsci` from `keyofscience` and get `keyence`.
It is impossible to reduce the length of the string to $6$ or less by repeating the operation, so the answer is $7$.
Input #2
oofsifffence
3
Output #2
2
Input #3
ooofff
5
Output #3
0
Input #4
okeyencef
4
Output #4
9
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。