CF282C.XOR and OR

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 aa , 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 xx and the other one as yy . Then he calculates two values pp and qq : p=x xor yp=x xor y , q=x or yq=x or y . Then he replaces one of the two taken characters by pp and the other one by qq .

The xorxor operation means the bitwise excluding OR operation. The oror 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 aa and bb . Your task is to check if it is possible for BitHaval to transform string aa to string bb in several (possibly zero) described operations.

输入格式

The first line contains Bitlandish string aa , the second line contains Bitlandish string bb . 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 10610^{6} .

输出格式

Print "YES" if aa can be transformed into bb , otherwise print "NO". Please do not print the quotes.

输入输出样例

  • 输入#1

    11
    10
    

    输出#1

    YES
    
  • 输入#2

    1
    01
    

    输出#2

    NO
    
  • 输入#3

    000
    101
    

    输出#3

    NO
    
首页