Problem
You are given a string $S$ of length $N$. Each character of $S$ is one of B, I, T, A, R, or O.
Determine whether IOI exists as a (not necessarily contiguous) subsequence of the string $S$. In other words, determine whether there exists a triple of $3$ integers $(i, j, k)$ that satisfies the following conditions:
- $1 \le i < j < k \le 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.
Constraints
- $1 \le N \le 100$.
- $S$ is a string of length $N$.
- Each character of $S$ is one of
B,I,T,A,R, orO.
Input
The input is given from Standard Input in the following format:
N S
Output
Output Yes if IOI exists as a subsequence of the string $S$, and No otherwise.
Sample Input and Output
Sample Input 1
8 BITAROOI
Sample Output 1
Yes
- The triples of $3$ integers $(2, 6, 8)$ and $(2, 7, 8)$ satisfy the conditions for $(i, j, k)$ in the problem statement. That is,
IOIexists as a subsequence of the string $S$, so outputYes.
Sample Input 2
6 BBOOII
Sample Output 2
No
IOIdoes not exist as a subsequence of the string $S$, so outputNo.
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