Codeforces Round 173 (Div. 2)
C
XOR and OR
Codeforces
1500
原题
← BD →
翻译中…

The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.

翻译中…

A Bitlandish string is a string made only of characters "0" and "1".

翻译中…

BitHaval (the mayor of Bitland) loves to play with Bitlandish strings. He takes some Bitlandish string $*a*$, and applies several (possibly zero) operations to it. In one operation the mayor may take any two adjacent characters of a string, define one of them as $*x*$ and the other one as $*y*$. Then he calculates two values $*p*$ and $*q*$: $*p* = *x* *xor* *y*$, $*q* = *x* *or* *y*$. Then he replaces one of the two taken characters by $*p*$ and the other one by $*q*$.

翻译中…

The $*xor*$ operation means the bitwise excluding OR operation. The $*or*$ operation is the bitwise OR operation.

翻译中…

So for example one operation can transform string 11 to string 10 or to string 01. String 1 cannot be transformed into any other string.

翻译中…

You've got two Bitlandish strings $*a*$ and $*b*$. Your task is to check if it is possible for BitHaval to transform string $*a*$ to string $*b*$ in several (possibly zero) described operations.

翻译中…

Input

翻译中…

The first line contains Bitlandish string $*a*$, the second line contains Bitlandish string $*b*$. The strings can have different lengths.

翻译中…

It is guaranteed that the given strings only consist of characters "0" and "1". The strings are not empty, their length doesn't exceed $10^{6}$.

翻译中…

Output

翻译中…

Print "YES" if $*a*$ can be transformed into $*b*$, otherwise print "NO". Please do not print the quotes.

翻译中…

样例

Input #1
11
10
Output #1
YES
InputCopy OutputCopy
Input #2
1
01
Output #2
NO
InputCopy OutputCopy
Input #3
000
101
Output #3
NO
InputCopy OutputCopy
题目信息
题号
282C
时间限制
2 s
内存限制
256 MB
标签
构造
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。