BETA

Difficulty Level:

Hard

Total Submissions: 1704 Accuracy:

8.51%

Similar expressions
     

Given two expressions in the form of strings. The task is to compare them and check if they are similar. Expressions consist of lowercase alphabets, '+', '-' and  '( )'.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains two lines. And each line contains an expression.

Output
For each test case, print in a new line "YES"  if the expressions are similar else print "NO".

Constraints:
1<=T<=100
3<=|Expression length|<=100

Example:
Input:
2
-(a+b+c)
-a-b-c

a-b-(c-d)
a-b-c-d

Output:
YES
NO

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Arun Tyagi

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.