#P1170C. Minus and Minus Give Plus

    ID: 2486 Type: RemoteJudge 3000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>*special problemimplementationstrings

Minus and Minus Give Plus

No submission language available for this problem.

Description

Everyone knows that two consecutive (adjacent) "minus" signs can be replaced with a single "plus" sign.

You are given the string ss, consisting of "plus" and "minus" signs only. Zero or more operations can be performed with it. In each operation you can choose any two adjacent "minus" signs, and replace them with a single "plus" sign. Thus, in one operation, the length of the string is reduced by exactly 11.

You are given two strings ss and tt. Determine if you can use 00 or more operations to get the string tt from the string ss.

The first line of the input contains an integer kk (1k1051 \le k \le 10^5), denoting the number of test cases in the input. The following lines contain descriptions of the test sets, each set consists of two lines. First comes the line containing ss (the length of the line ss does not exceed 21052\cdot10^5), then comes the line containing tt (the length of the line tt does not exceed 21052\cdot10^5). The lines ss and tt are non-empty, and they contain only "plus" and "minus" signs.

The sum of the lengths of lines ss over all test cases in the input does not exceed 21052\cdot10^5. Similarly, the sum of the lengths of lines tt over all test cases in the input does not exceed 21052\cdot10^5.

Print kk lines: the ii-th line must contain YES if the answer to the ii-th test case is positive, otherwise NO. Print YES and NO using uppercase letters only.

Input

The first line of the input contains an integer kk (1k1051 \le k \le 10^5), denoting the number of test cases in the input. The following lines contain descriptions of the test sets, each set consists of two lines. First comes the line containing ss (the length of the line ss does not exceed 21052\cdot10^5), then comes the line containing tt (the length of the line tt does not exceed 21052\cdot10^5). The lines ss and tt are non-empty, and they contain only "plus" and "minus" signs.

The sum of the lengths of lines ss over all test cases in the input does not exceed 21052\cdot10^5. Similarly, the sum of the lengths of lines tt over all test cases in the input does not exceed 21052\cdot10^5.

Output

Print kk lines: the ii-th line must contain YES if the answer to the ii-th test case is positive, otherwise NO. Print YES and NO using uppercase letters only.

Samples

Sample Input 1

5
-+--+
-+++
--------
-+--+-
-
+
--
---
+++
+++

Sample Output 1

YES
YES
NO
NO
YES