QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 1024 MB

#23920. สตริงซ้ำ

Statistiques

สตริงที่ได้จากการนำสตริงเดียวกัน $2$ ตัวมาต่อกัน จะเรียกว่า สตริงซ้ำ

ตัวอย่างเช่น OIOI, JJJJJJ และ JOIOIJOIOI เป็นสตริงซ้ำ ในขณะที่ IOOI และ JOIIOI ไม่ใช่สตริงซ้ำ

กำหนดสตริง $S$ ที่มีความยาว $N$ โดยที่ $N$ เป็นจำนวนคู่ และอักขระแต่ละตัวของ $S$ เป็นตัวใดตัวหนึ่งจาก J, O หรือ I

หาก $S$ เป็นสตริงซ้ำให้แสดงผล Yes มิฉะนั้นให้แสดงผล No

ข้อจำกัด

  • $2 \le N \le 100$
  • $N$ เป็นจำนวนคู่
  • $S$ เป็นสตริงที่มีความยาว $N$
  • อักขระแต่ละตัวของ $S$ เป็นตัวใดตัวหนึ่งจาก J, O หรือ I

ข้อมูลนำเข้า

ข้อมูลนำเข้าจะถูกกำหนดให้จากอินพุตมาตรฐานในรูปแบบต่อไปนี้:

N
S

ข้อมูลส่งออก

หาก $S$ เป็นสตริงซ้ำให้แสดงผล Yes มิฉะนั้นให้แสดงผล No

ตัวอย่าง

ข้อมูลนำเข้า 1

6
JOIJOI

ข้อมูลส่งออก 1

Yes

หมายเหตุ

  • เนื่องจาก JOIJOI ได้จากการนำ JOI จำนวน $2$ ตัวมาต่อกัน จึงเป็นสตริงซ้ำ ดังนั้นจึงแสดงผล Yes

ข้อมูลนำเข้า 2

6
IOIOIO

ข้อมูลส่งออก 2

No

หมายเหตุ

  • เนื่องจาก IOIOIO ไม่สามารถได้จากการนำสตริงเดียวกัน $2$ ตัวมาต่อกัน จึงไม่ใช่สตริงซ้ำ ดังนั้นจึงแสดงผล No

ข้อมูลนำเข้า 3

2
OO

ข้อมูลส่งออก 3

Yes

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.