问题 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 $\textstyle S$ is a valid opening statement, then $\textstyle S+\texttt{ava}$ and $\textstyle \texttt{ava}+S$ are also valid opening statements.
    
-   If $\textstyle S$ is a valid opening statement, then $\textstyle S+\texttt{avava}$ and $\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 $\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 $\textstyle T$ ($\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 $\textstyle S$ ($\textstyle 3\leq |S|\leq 5\times 10^5$), consisting of lowercase letters of the English alphabet.

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

输出格式

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

输入样例 复制

5
ava
avavaava
avavava
avaava
haitang

输出样例 复制

Yes
Yes
No
Yes
No

分类标签