Bitaro and IOI
Time limit2sMemory limit1024 MB
Given a short string over B, I, T, A, R, O, decide whether it contains the subsequence I, O, I in order.
- Level
Easy2 of 10
- Topics
- String, Greedy, Implementation
- Solved
- No attempts yet
Problem
You are given a string S of length N. Each character of S is one of B, I, T, A, R, O.
Determine whether the string S has IOI as a (not necessarily contiguous) subsequence. In other words, determine whether there exist three integers (i,j,k) satisfying the following conditions.
1 ≦ i < j < k ≦ N.- The
i-th character ofSisI. - The
j-th character ofSisO. - The
k-th character ofSisI.
Input
The input is given from standard input in the following format.
N
S
Output
If the string S has IOI as a subsequence, print Yes; otherwise, print No.
Constraints
1 ≦ N ≦ 100.Sis a string of lengthN.- Each character of
Sis one ofB,I,T,A,R,O.