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

建议使用的浏览器:

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

6282:String Transformation

题目描述
Bobo has a string $S = s_1s_2\dots s_n$ consists of letter `a`, `b` and `c`.
He can transform the string by inserting or deleting substrings `aa`, `bb` and `abab`.

Formally, $A = u \circ w \circ v$ (``$\circ$'' denotes string concatenation) can be transformed into $A' = u \circ v$ and vice versa where $u$, $v$ are (possibly empty) strings and $w \in \{\mathrm{aa}, \mathrm{bb}, \mathrm{abab}\}$.

Given the target string $T = t_1t_2\dots t_m$, determine if Bobo can transform the string $S$ into $T$.
输入解释
The input consists of several test cases and is terminated by end-of-file.

The first line of each test case contains a string $s_1 s_2\dots s_n$.
The second line contains a string $t_1t_2\dots t_m$.
输出解释
For each test case, print `Yes` if Bobo can. Print `No` otherwise.

## Constraint

* $1 \leq n, m \leq 10^4$
* $s_1, s_2, \dots, s_n, t_1, t_2, \dots, t_m \in \{\mathrm{a}, \mathrm{b}, \mathrm{c}\}$
* The sum of $n$ and $m$ does not exceed $250,000$.
输入样例
ab
ba
ac
ca
a
ab
输出样例
Yes
No
No

提示

For the first sample, Bobo can transform as `ab => aababb => babb => ba`.

来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6282

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

共提交 0

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