QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 1024 MB

#23920. Repeating String

Estadísticas

問題文

同じ文字列を 2 つつなげて得られる文字列を繰り返し文字列と呼ぶことにする.

例えば,OIOI や JJJJJJ,JOIOIJOIOI は繰り返し文字列であるが,IOOI や JOIIOI は繰り返し文字列ではない.

長さ N の文字列 S が与えられる.N は偶数であり,S の各文字は J,O,I のいずれかである.

S が繰り返し文字列である場合は Yes を,そうでない場合は No を出力せよ.

制約

  • 2 ≦ N ≦ 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.