问题 E: Haitang and Ava

内存限制:256 MB 时间限制:1 S
题面:传统 评测方式:Special Judge 上传者:
提交:2 通过:2

题目描述

_One day, Haitang found that Ava would not hold live streaming anymore._

Ava would say an opening statement at the beginning of the live streaming.

The conditions for a valid opening statement are as follows:

-   An empty string is a valid opening statement.
    
-   If S\textstyle S is a valid opening statement, then S+ava\textstyle S+\texttt{ava} and ava+S\textstyle \texttt{ava}+S are also valid opening statements.
    
-   If S\textstyle S is a valid opening statement, then S+avava\textstyle S+\texttt{avava} and avava+S\textstyle \texttt{avava}+S are also valid opening statements.
    
-   Any string that cannot be constructed using the above methods is not a valid opening statement.
    

Given a string S\textstyle S, you need to determine if it is a valid opening statement.

输入格式

Each test contains multiple test cases. The first line contains an integer T\textstyle T (1T1.7×105\textstyle 1\leq T\leq 1.7\times 10^5) — the number of test cases. The description of the test cases follows.

The first and only line of each test case contains a string S\textstyle S (3S5×105\textstyle 3\leq |S|\leq 5\times 10^5), consisting of lowercase letters of the English alphabet.

It is guaranteed that the sum of S\textstyle |S| over all test cases does not exceed 5×105\textstyle 5\times 10^5.

输出格式

For each test case, output “Yes” if S\textstyle S is a valid opening statement, and “No” otherwise.

输入样例 复制

5
ava
avavaava
avavava
avaava
haitang

输出样例 复制

Yes
Yes
No
Yes
No

分类标签