题目描述
Problem Description
Takahashi has a string $ S $. He likes the string yahoo and wants to edit $ S $ to make it a string that can be obtained by repeating yahoo. Here, a string obtained by repeating yahoo means a string that can be formed by concatenating yahoo zero or more times. These strings are, in order from shortest to longest: (empty string), yahoo, yahooyahoo, ...
Takahashi can perform one of the following operations in one step:
- Replace any one character in $ S $ with any lowercase English letter.
- Remove any one character from $ S $.
- Insert any lowercase English letter at any position in $ S $.
Find the minimum number of operations required for Takahashi to make $ S $ a string that can be obtained by repeating yahoo.
Input Format
The input is given from the standard input in the following format:
$ S $
Output Format
Print the minimum number of operations required for Takahashi to make $ S $ a string that can be obtained by repeating yahoo.
Sample Input and Output
Sample Input #1
yfoo
Sample Output #1
2
Sample Input #2
z
Sample Output #2
1
Sample Input #3
yahooyahooyahooyahooyahoo
Sample Output #3
0
Sample Input #4
yahyahoo
Sample Output #4
2
Notes/Hints
Constraints
- $1 \leq |S| \leq 10^5$
- $ S $ consists of lowercase English letters.
Sample Explanation 1
For example, the following operations can be performed:
- Replace the second character f with h. $ S $ becomes yhoo.
- Insert a between the first and second characters. $ S $ becomes yahoo.
Sample Explanation 2
Removing the first character z makes $ S $ an empty string, which is a string that can be obtained by repeating yahoo.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分