P26536 [AtCoder] Next Character
提高-
题目描述

Problem Description

You are given a string $ S $ of length $ N $. Each character in $ S $ is either J, O, or I.

Bitaro the beaver performed $ N - 1 $ actions. The $ i $-th ($1 \leq i \leq N - 1$) action was performed as follows:

  • Check the $ i + 1 $-th character of $ S $. If the $ i + 1 $-th character of $ S $ is J, write the $ i $-th character of $ S $ on the blackboard.

Output all the characters that Bitaro wrote on the blackboard during the $ N - 1 $ actions, in the order they were written, separated by newlines.

Input Format

The input is given from the standard input in the following format:

$ N $ $ S $

Output Format

Output all the characters that Bitaro wrote on the blackboard during the $ N - 1 $ actions, in the order they were written, separated by newlines.

Sample Input and Output

Sample Input #1

6
IOJOIJ

Sample Output #1

O
I

Sample Input #2

4
JJOI

Sample Output #2

J

Sample Input #3

7
IOJOJOJ

Sample Output #3

O
O
O

Sample Input #4

5
JJJJJ

Sample Output #4

J
J
J
J

Notes/Hints

Constraints

  • $2 \leq N \leq 100$.
  • $ S $ is a string of length $ N $.
  • Each character in $ S $ is either J, O, or I.
  • $ N $ is an integer.
  • There is at least one character written on the blackboard.

Sample Explanation 1

Bitaro performed the following $ 5 $ actions:
- In the 1st action, he checked the 2nd character of $ S $.
- In the 2nd action, he checked the 3rd character of $ S $. Since the 3rd character is J, he wrote the 2nd character O on the blackboard.
- In the 3rd action, he checked the 4th character of $ S $.
- In the 4th action, he checked the 5th character of $ S $.
- In the 5th action, he checked the 6th character of $ S $. Since the 6th character is J, he wrote the 5th character I on the blackboard.

Therefore, output O and I in this order, separated by newlines.

Sample Explanation 2

Bitaro wrote the 1st character J of $ S $ on the blackboard in the 1st action. He did not write anything on the blackboard in the 2nd and 3rd actions.

Therefore, output J.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 IOJOIJ
样例输出
O I