8545: Kazuha's String

内存限制:128 MB 时间限制:7 S
题面:传统 评测方式:文本比较 上传者:
提交:2 通过:1

题目描述

Kazuha has two strings S1 and S2 consisting of lowercase letters "a", "b" and "c", here are the possible operations:

Add or Delete "aa" at any place of the string.

Add or Delete "bbb" at any place of the string.

Add or Delete "cccc" at any place of the string.

Add or Delete "abababab" at any place of the string.

Add or Delete "acacac" at any place of the string.

Add or Delete "bcbc" at any place of the string.

Add or Delete "abc" at any place of the string.

Kazuha can operate any time with any operations, determine if s1 can be transformed into S2 .

输入格式

The first line contains one integer T(1T2×105) .

The first line of each test case contains a single string S1 .

The second line of each test case contains a single string S2.

It guaranteed that the length of each string does not exceed 105, and the sum of string lengths does not exceed 2×106.

输出格式

For each test case, print a single line containing "yes" if S1 can be transformed into S2 and "no" otherwise.

输入样例 复制

3
aa
bbb
bab
acc
acbacccac
bbcacacbc

输出样例 复制

yes
yes
no