QOJ.ac

QOJ

时间限制: 2 s 内存限制: 64 MB 总分: 100

#23768. JOI และ IOI

统计

โจทย์ปัญหา

จงเขียนโปรแกรมเพื่อนับว่าในสตริงที่กำหนดให้มีตำแหน่งที่ตัวอักษร $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.