题目描述
Problem Description
Given a string \( S \) of odd length \( N \). Each character in \( S \) is an uppercase letter.
An IOI string is a string that satisfies all of the following conditions:
- Its length is odd.
- Each character is either
IorO, and they alternate. - The first character is
I.
For example, I, IOI, IOIOIOI are IOI strings, but JOI, IIOOII, OIOIO are not IOI strings.
You can perform the following operation any number of times (including zero):
- Choose one character in the string \( S \) and change it to any uppercase letter.
Find the minimum number of operations needed to convert the string \( S \) into an IOI string.
Input Format
The input is given from the standard input in the following format:
\( N \) \( S \)
Output Format
Output the minimum number of operations needed to convert the string \( S \) into an IOI string.
Sample Input and Output
Sample Input #1
5
JJOOI
Sample Output #1
3
Sample Input #2
7
IOIOIOI
Sample Output #2
0
Sample Input #3
7
BEAVERS
Sample Output #3
7
Sample Input #4
5
OIOIO
Sample Output #4
5
Notes/Hints
Constraints
- \( 1 \leq N \leq 99 \).
- \( N \) is odd.
- \( S \) is a string of length \( N \).
- Each character in \( S \) is an uppercase letter.
Sample Explanation 1
For example, you can make \( S \) an IOI string with 3 operations as follows:
1. Change the first character of \( S \) to I.
2. Change the second character of \( S \) to O.
3. Change the third character of \( S \) to I.
It is impossible to make \( S \) an IOI string with fewer than 3 operations, so output 3.
Sample Explanation 2
Sometimes no operations are needed.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分