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$ 行,包含 $1$ 個長度唔超過 $10000$ 嘅大寫英文字母字符串。

輸出格式

輸出有 $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.