QOJ.ac

QOJ

Límite de tiempo: 2.0 s Límite de memoria: 256 MB Puntuación total: 100 Hackeable ✓

#17737. MITIT

Estadísticas

一個好的競賽必須有一個好的名稱。Busy Beaver 對於如何為他的下一個大型程式設計競賽命名有很多想法;你能告訴他哪些是最好的嗎?

一個「單字」(word)是指一個僅包含大寫字母且長度至少為 1 的字串。一個「好的競賽名稱」是指一個可以寫成 $ABB$ 形式的單字,其中 $A$ 和 $B$ 皆為單字。

給定 $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.