CF1759A.Yes-Yes?

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You talked to Polycarp and asked him a question. You know that when he wants to answer "yes", he repeats Yes many times in a row.

Because of the noise, you only heard part of the answer — some substring of it. That is, if he answered YesYes, then you could hear esY, YesYes, sYes, e, but you couldn't Yess, YES or se.

Determine if it is true that the given string ss is a substring of YesYesYes... (Yes repeated many times in a row).

你与波利卡普交谈并问他一个问题。你知道,当他想回答“是”时,他会连续重复多次“Yes”。

由于存在噪音,你只听到了答案的一部分——即它的某个子串。也就是说,如果他回答的是“YesYes”,那么你可能听到的是“esY”、“YesYes”、“sYes”或“e”,但不可能听到“Yess”、“YES”或“se”。

请判断给定字符串 ss 是否为“YesYesYes...”(即“Yes”连续重复多次所构成的字符串)的一个子串。

输入格式

The first line of input data contains the singular tt (1≤t≤10001 \le t \le 1000) — the number of test cases in the test.

Each test case is described by a single string of Latin letters ss (1≤∣s∣≤501 \le |s| \le 50) — the part of Polycarp's answer that you heard, where ∣s∣|s| — is the length of the string ss.

输入数据的第一行包含一个整数 tt(1≤t≤10001 \le t \le 1000),表示测试用例的数量。

每个测试用例由一个仅包含拉丁字母的字符串 ss 描述(1≤∣s∣≤501 \le |s| \le 50),即你所听到的 Polycarp 回答的一部分,其中 ∣s∣|s| 表示字符串 ss 的长度。

输出格式

Output tt lines, each of which is the answer to the corresponding test case. As an answer, output "YES" if the specified string ss is a substring of the string YesYesYes...Yes (the number of words Yes is arbitrary), and "NO" otherwise.

You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

输出 tt 行,每行对应一个测试用例的答案。若指定的字符串 ss 是字符串 YesYesYes...Yes(其中 "Yes" 出现任意多次)的子串,则输出 "YES";否则输出 "NO"。

你可以以任意大小写形式输出答案(例如,字符串 "yEs"、"yes"、"Yes" 和 "YES" 均被视为肯定回答)。

输入输出样例

  • 输入#1

    12
    YES
    esYes
    codeforces
    es
    se
    YesY
    esYesYesYesYesYesYe
    seY
    Yess
    sY
    o
    Yes

    输出#1

    NO
    YES
    NO
    YES
    NO
    YES
    YES
    NO
    NO
    YES
    NO
    YES

输入解题思路,AI测评打分。不知道怎么写?

首页