This page is still under construction.

Parts of this page are still being built. What you see may change.

Bitaro and IOI

Time limit2sMemory limit1024 MB

Summary
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 of S is I.
  • The j-th character of S is O.
  • The k-th character of S is I.

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.
  • S is a string of length N.
  • Each character of S is one of B, I, T, A, R, O.

Examples5

  1. Example 1

    Input
    8
    BITAROOI
    
    Expected output
    Yes
    
  2. Example 2

    Input
    6
    BBOOII
    
    Expected output
    No
    
  3. Example 3

    Input
    5
    IOIOI
    
    Expected output
    Yes
    
  4. Example 4

    Input
    9
    RATRATRAT
    
    Expected output
    No
    
  5. Example 5

    Input
    1
    A
    
    Expected output
    No