Problem10354--ABC325 —— G - offence

10354: ABC325 —— G - offence

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

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 `of` in the string and an integer $i$ between $0$ and $K$, inclusive. Then, remove the `of` and the following $i$ characters from the string.

Input

The input is given from Standard Input in the following format:

```
$S$
$K$
```

Output

Print the answer.

Constraints

-   $0 \leq K < |S| \leq 300$
-   $K$ is an integer.
-   $S$ is a string consisting of lowercase English letters.

Sample 1 Input

keyofscience
3

Sample 1 Output

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.

Sample 2 Input

oofsifffence
3

Sample 2 Output

2

Sample 3 Input

ooofff
5

Sample 3 Output

0

okeyencef
4

9

Source/Category