QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 64 MB Total points: 100

#23768. JOI と IOI

Statistics

問題

与えられた文字列の中に,連続する $3$ 文字が,JOI または IOI という並びになっている個所がそれぞれ何個所あるのかを数え上げるプログラムを作成せよ.文字列はアルファベットの大文字だけからなる.例えば下図の「JOIOIOI」という文字列には JOI が $1$ 個所,IOI が $2$ 個所に含まれている.

sample

入力

入力は $1$ 行からなり,そこには $10000$ 文字以下のアルファベットの大文字からなる $1$ つの文字列が含まれる.

出力

出力は $2$ 行からなり, $1$ 行目には見つけられた JOI の個数を, $2$ 行目には見つけられた IOI の個数をそれぞれ出力せよ.

入出力例

入力例 1

JOIJOI

出力例 1

2
0

入力例 2

JOIOIOIOI

出力例 2

1
3

入力例 3

JOIOIJOINXNXJIOIOIOJ

出力例 3

2
3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.