QOJ.ac

QOJ

Limite de temps : 2.0 s Limite de mémoire : 256 MB Points totaux : 100 Hackable ✓

#17737. MITIT

Statistiques

A good contest must have a good contest name. Busy Beaver has many ideas for how to name his next great programming contest; can you tell him which ones are the best?

problem_17737_1.png

A word is a string (of length at least one) containing only uppercase letters. A good contest name is a word that can be written in the form $ABB$ where $A$ and $B$ are words.

You're given $Q$ strings of uppercase letters. For $i=1 \ldots Q$, output "YES" if the $i^\text{th}$ string is a good contest name, and "NO" otherwise.

Input

The first line contains $Q$ ($1 \le Q \le 100$).

The next $Q$ lines contain one string each. Each string consists of between $3$ and $5000$ uppercase letters.

It is guaranteed that the sum of lengths of all strings is at most $5000$.

Output

Output $Q$ lines, the answer for each string. The output is case insensitive, so "YES", "yes", and "Yes", for example, will be treated identically.

Examples

Input 1

5
MITIT
MITIIT
AAA
KLDSJLAJJLAJJ
ABCABC

Output 1

YES
NO
YES
YES
NO

Note

Explanation:

MITIT can be written as [M][IT][IT].

MITIIT cannot be written as $ABB$ for any words $A$ and $B$.

AAA can be written as [A][A][A].

KLDSJLAJJLAJJ can be written as [KLDSJ][LAJJ][LAJJ] or [KLDSJLAJJLA][J][J].

ABCABC cannot be written as $ABB$ for any words $A$ and $B$ ([][ABC][ABC] doesn't count because the first word cannot be empty).

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.