题目描述
Problem Description
Given a string \( S \) of length \( N \). Each character in \( S \) is one of B, I, T, A, R, O.
Determine if the subsequence (not necessarily contiguous) of the string \( S \) contains IOI. In other words, determine if there exist a triplet of integers \( (i, j, k) \) that satisfies the following conditions:
- \( 1 \leq i < j < k \leq N \).
- The \( i \)-th character of \( S \) is
I. - The \( j \)-th character of \( S \) is
O. - The \( k \)-th character of \( S \) is
I.
Input Format
The input is given from the standard input in the following format:
\( N \) \( S \)
Output Format
If the subsequence of the string \( S \) contains IOI, output Yes; otherwise, output No.
Sample Input and Output
Sample Input #1
8
BITAROOI
Sample Output #1
Yes
Sample Input #2
6
BBOOII
Sample Output #2
No
Sample Input #3
5
IOIOI
Sample Output #3
Yes
Sample Input #4
9
RATRATRAT
Sample Output #4
No
Sample Input #5
1
A
Sample Output #5
No
Notes/Hints
Constraints
- \( 1 \leq N \leq 100 \).
- \( S \) is a string of length \( N \).
- Each character in \( S \) is one of
B,I,T,A,R,O.
Sample Explanation 1
The triplet of integers \( (2, 6, 8) \) or \( (2, 7, 8) \) satisfies the conditions of \( (i, j, k) \) in the problem statement. Therefore, since the subsequence of the string \( S \) contains IOI, output Yes.
Sample Explanation 2
The subsequence of the string \( S \) does not contain IOI, so output No.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分