当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5284:wyh2000 and a string problem

题目描述
Young theoretical computer scientist wyh2000 is teaching young pupils some basic concepts about strings.

A subsequence of a string $s$ is a string that can be derived from $s$ by deleting some characters without changing the order of the remaining characters. You can delete all the characters or none, or only some of the characters.

He also teaches the pupils how to determine if a string is a subsequence of another string. For example, when you are asked to judge whether $\text{wyh}$ is a subsequence of some string or not, you just need to find a character $\text{w}$, a $\text{y}$, and an $\text{h}$, so that the $\text{w}$ is in front of the $\text{y}$, and the $\text{y}$ is in front of the $\text{h}$.

One day a pupil holding a string asks him, "Is $\text{wyh}$ a subsequence of this string?"
However, wyh2000 has severe myopia. If there are two or more consecutive character $\text{v}$s, then he would see it as one $\text{w}$. For example, the string $\text{vvv}$ will be seen as $\text{w}$, the string $\text{vvwvvv}$ will be seen as $\text{www}$, and the string $\text{vwvv}$ will be seen as $\text{vww}$.

How would wyh2000 answer this question?
输入解释
The first line of the input contains an integer $T(T\le 10^5)$, denoting the number of testcases.

$N$ lines follow, each line contains a string.

Total string length will not exceed 3145728. Strings contain only lowercase letters.

The length of hack input must be no more than 100000.
输出解释
For each string, you should output one line containing one word. Output $\text{Yes}$ if wyh2000 would consider $\text{wyh}$ as a subsequence of it, or $\text{No}$ otherwise.
输入样例
4
woshiyangli
woyeshiyangli
vvuuyeh
vuvuyeh
输出样例
No
Yes
Yes
No
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5284

最后修改于 2020-10-25T23:21:20+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/65536K(Java/Others)