QOJ.ac

QOJ

시간 제한: 2 s 메모리 제한: 1024 MB

#23920. 반복 문자열

통계

같은 문자열 $2$개를 이어 붙여서 얻을 수 있는 문자열을 반복 문자열이라고 부르기로 하자.

예를 들어 OIOI, JJJJJJ, JOIOIJOIOI는 반복 문자열이지만, IOOI나 JOIIOI는 반복 문자열이 아니다.

길이 $N$인 문자열 $S$가 주어진다. $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.