QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#17737. MITIT

Statistics

좋은 대회에는 좋은 대회 이름이 필요합니다. Busy Beaver는 다음 프로그래밍 대회의 이름을 짓기 위한 여러 아이디어를 가지고 있습니다. 어떤 것이 가장 좋은지 알려줄 수 있을까요?

단어(word)는 대문자만으로 이루어진 (길이가 1 이상인) 문자열입니다. 좋은 대회 이름(good contest name)은 $A$와 $B$가 단어일 때 $ABB$ 형태로 쓸 수 있는 단어입니다.

대문자로 이루어진 $Q$개의 문자열이 주어집니다. $i=1 \ldots Q$에 대하여, $i$번째 문자열이 좋은 대회 이름이면 "YES"를, 아니면 "NO"를 출력하세요.

입력

첫 번째 줄에는 $Q$ ($1 \le Q \le 100$)가 주어집니다.

다음 $Q$개의 줄에는 각각 하나의 문자열이 주어집니다. 각 문자열은 $3$에서 $5000$ 사이의 대문자로 구성됩니다.

모든 문자열 길이의 합은 최대 $5000$임이 보장됩니다.

출력

$Q$개의 줄에 걸쳐 각 문자열에 대한 답을 출력하세요. 출력은 대소문자를 구분하지 않으므로, 예를 들어 "YES", "yes", "Yes"는 모두 동일하게 처리됩니다.

예제

입력 1

5
MITIT
MITIIT
AAA
KLDSJLAJJLAJJ
ABCABC

출력 1

YES
NO
YES
YES
NO

참고

설명:

MITIT은 [M][IT][IT]로 쓸 수 있습니다.

MITIIT은 어떤 단어 $A$와 $B$에 대해서도 $ABB$ 형태로 쓸 수 없습니다.

AAA는 [A][A][A]로 쓸 수 있습니다.

KLDSJLAJJLAJJ는 [KLDSJ][LAJJ][LAJJ] 또는 [KLDSJLAJJLA][J][J]로 쓸 수 있습니다.

ABCABC는 어떤 단어 $A$와 $B$에 대해서도 $ABB$ 형태로 쓸 수 없습니다 ([][ABC][ABC]는 첫 번째 단어가 비어있을 수 없으므로 해당하지 않습니다).

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.