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.


-----Examples-----
Input
11
10

Output
YES

Input
1
01

Output
NO

Input
000
101

Output
NO

Difficulty: MEDIUM

Solutions:
a = input()
b = input()
if len(a) != len(b):
	print('NO')
elif a.count('1') == 0 and b.count('1') > 0:
	print('NO')
elif a.count('1') > 0 and b.count('1') == 0:
	print('NO')
else:
	print('YES')


import os
from sys import stdin, stdout

def solve(tc):
	a = stdin.readline().strip()
	b = stdin.readline().strip()
	na = len(a)
	nb = len(b)
	if na != nb:
		print('NO')
		return
	allZero = [True, True]
	for i in range(na):
		if a[i] == '1':
			allZero[0] = False
			break
	for i in range(nb):
		if b[i] == '1':
			allZero[1] = False
			break
	if allZero[0] == allZero[1]:
		print('YES')
	else:
		print('NO')
tcs = 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


def main():
	(aa, bb) = (input(), input())
	print(('NO', 'YES')[len(aa) == len(bb) and any((c == '1' for c in aa)) == any((c == '1' for c in bb))])
main()


a = input()
b = input()
if len(a) != len(b):
	print('NO')
elif a == b:
	print('YES')
elif '1' in a and '1' in b:
	print('YES')
else:
	print('NO')


import random

def er():
	print('NO')
	exit(0)

def ok():
	print('YES')
	exit(0)

def main():
	a = input()
	b = input()
	n = len(a)
	m = len(b)
	if n != m:
		er()
	if n == 1:
		if a == b:
			ok()
		else:
			er()
	x = 0
	y = 0
	for i in a:
		if i == '1':
			x += 1
	for i in b:
		if i == '1':
			y += 1
	if x == 0 and y != 0:
		er()
	if x != 0 and y == 0:
		er()
	ok()
main()
print('\n')


import sys
a = input()
b = input()
ca = a.count('0')
cb = b.count('0')
if len(a) != len(b):
	print('NO')
	sys.exit()
elif a == b:
	print('YES')
	sys.exit()
if '1' not in a or '1' not in b:
	print('NO')
else:
	print('YES')


import sys
a = sys.stdin.readline().strip()
b = sys.stdin.readline().strip()
valid = len(a) == len(b)
if '1' not in a or '1' not in b or len(a) <= 1:
	valid = valid and a == b
if valid:
	print('YES')
else:
	print('NO')


a = input()
b = input()
n = len(a)
if n != len(b):
	print('NO')
	return
if n == 1 and a != b:
	print('NO')
	return
if (a.count('1') > 0) == (b.count('1') > 0):
	print('YES')
else:
	print('NO')


from collections import defaultdict as dd, deque as dq
import math, string
import sys

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	(A, B) = (getStr(), getStr())
	if len(A) != len(B):
		return 'NO'
	if '1' not in A and '1' in B:
		return 'NO'
	if '1' not in B and '1' in A:
		return 'NO'
	return 'YES'
print(solve())


a = input()
b = input()
if len(a) != len(b):
	print('NO')
elif a == b:
	print('YES')
elif a == '0' * len(a) or b == '0' * len(b):
	print('NO')
else:
	print('YES')


import math
s1 = input()
s2 = input()
ans1 = 0
for i in s1:
	if i == '0':
		ans1 += 1
ans2 = 0
for i in s2:
	if i == '0':
		ans2 += 1
if s1 == s2:
	print('YES')
elif len(s1) != len(s2) or ans1 == len(s1) or len(s1) == 1 or (ans2 == len(s2)):
	print('NO')
else:
	print('YES')


a = input()
b = input()
if len(a) != len(b) or ('1' in a) != ('1' in b):
	print('NO')
else:
	print('YES')


s1 = input()
s2 = input()
if '1' in s1 and '1' not in s2 or ('1' in s2 and '1' not in s1) or len(s1) != len(s2):
	print('NO')
else:
	print('YES')


(a, b) = (input(), input())
print('YNEOS'[len(a) != len(b) or '1' in set(a) ^ set(b)::2])


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
a = list(input().strip())
b = list(input().strip())
if a == b:
	print('YES')
elif len(a) != len(b):
	print('NO')
else:
	print('YNEOS'['1' not in a and '1' in b or ('1' not in b and '1' in a)::2])


x = input()
y = input()
if x == y:
	print('YES')
elif len(x) != len(y):
	print('NO')
else:
	x1 = list(set(list(x)))
	y1 = list(set(list(y)))
	if len(x1) == 2 and len(y1) == 2:
		print('YES')
	elif len(x1) == 1 and len(y1) == 1:
		print('NO')
	elif len(x1) == 1 and len(y1) == 2:
		if x1[-1] == '0':
			print('NO')
		else:
			print('YES')
	elif y1[-1] == '0':
		print('NO')
	else:
		print('YES')


import time, math, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count

def solve():
	a = input()
	b = input()
	if a == b:
		print('YES')
		return
	elif len(a) < len(b) or len(a) > len(b):
		print('NO')
		return
	elif a != b and len(a) == 1:
		print('NO')
	elif a == '0' * len(a):
		print('NO')
	elif b == '0' * len(a):
		print('NO')
	else:
		print('YES')
solve()


st = input()
st1 = input()
if len(st) != len(st1):
	print('NO')
elif st.count('1') > 0 and st1.count('1') > 0:
	print('YES')
elif st.count('0') == st1.count('0'):
	print('YES')
else:
	print('NO')


import sys
first = sys.stdin.readline().strip()
second = sys.stdin.readline().strip()
if len(first) != len(second):
	print('NO')
	return
(count1, count2) = (0, 0)
for i in first:
	if i == '1':
		count1 += 1
for i in second:
	if i == '1':
		count2 += 1
if count1 == 0 and count2 != 0 or (count1 != 0 and count2 == 0):
	print('NO')
	return
print('YES')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
	exit(0)
if len(a) == 1:
	if a == b:
		print('YES')
	else:
		print('NO')
	exit(0)
flag = 0
if a.count('0') == len(a) and a == b:
	print('YES')
	exit(0)
elif (a.count('0') == len(a) or b.count('0') == len(b)) and a != b:
	print('NO')
	exit(0)
print('YES')


import sys
import time
import os
from math import sqrt, log, log2, ceil, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()
write = lambda x: sys.stdout.write(x)

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def fun(arr, mid, l):
	n = len(arr)
	if mid < arr[0] or mid < l - arr[-1]:
		return False
	for i in range(n - 1):
		if not arr[i] + mid >= arr[i + 1] - mid:
			return False
	return True

def solve():
	s = inp()
	t = inp()
	if len(s) != len(t):
		print('NO')
		return
	if s == t:
		print('YES')
		return
	ss = list(set(list(s)))
	st = list(set(list(t)))
	if len(st) == 1 and st[0] == '0':
		print('NO')
		return
	if len(ss) == 1 and ss[0] == '0':
		print('NO')
		return
	print('YES')
start_time = time.time()
solve()


(a, b) = (input(), input())

def check(s):
	for i in s:
		if i != '0':
			return True
	return False
print('YES' if len(a) == len(b) and (a == b or check(a) == check(b)) else 'NO')


import sys
x = input()
y = input()
if len(x) != len(y):
	print('NO')
	sys.exit()
if x.count('1') == 0:
	if y.count('1') == 0:
		print('YES')
	else:
		print('NO')
elif y.count('1') == 0:
	print('NO')
else:
	print('YES')


from sys import stdin
(a, b) = (stdin.readline().strip(), stdin.readline().strip())
if len(a) != len(b):
	print('NO')
else:
	x = set(a)
	y = set(b)
	if x == {'0'} and y != x or (y == {'0'} and x != y):
		print('NO')
	else:
		print('YES')


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import ceil
mod = 10 ** 9 + 7
for _ in range(1):
	a = input()
	b = input()
	(n, m) = (len(a), len(b))
	if n != m or '1' in set(list(a)) ^ set(list(b)):
		print('NO')
	else:
		print('YES')


a = input()
b = input()
na = len(a)
nb = len(b)
ops = 0
updates = 0
if a == b:
	print('YES')
	exit()
if na != nb or na < 2 or nb < 2:
	print('NO')
else:
	x = a.replace('0', '')
	y = b.replace('0', '')
	if len(x) == 0 or len(y) == 0:
		print('NO')
	else:
		print('YES')


str1 = input()
str2 = input()
import sys
x = False
y = False
if len(str1) != len(str2) or (len(str1) == 1 and str1[0] != str2[0]):
	print('NO')
	sys.exit(0)
else:
	for i in range(0, len(str1)):
		if str1[i] == '1':
			x = True
		if str2[i] == '1':
			y = True
if len(str1) == 1 and str1[0] == '0' and (str2[0] == '0'):
	print('YES')
	sys.exit(0)
if x == True and y == True or (x == False and y == False):
	print('YES')
else:
	print('NO')


def main():
	a = input()
	b = input()
	if a == b:
		print('YES')
	elif a.count('1') == 0 or b.count('1') == 0 or len(a) != len(b):
		print('NO')
	else:
		print('YES')
main()


A = input()
B = input()
if len(A) != len(B):
	print('NO')
else:
	A1 = '1' in A
	B1 = '1' in B
	if A1 == B1:
		print('YES')
	else:
		print('NO')


x1 = input()
x2 = input()
if len(x1) == len(x2) and '1' in x1 and ('1' in x2) or x1 == x2:
	print('YES')
else:
	print('NO')


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
a = input()
b = input()
if len(a) == len(b) and '1' in a and ('1' in b) or a == b:
	print('YES')
else:
	print('NO')


f = lambda x: (len(x), any((c == '1' for c in x)))
print(('NO', 'YES')[f(input()) == f(input())])


s = input()
t = input()
if len(s) != len(t) or (s.count('1') == 0 and t.count('1') > 0) or (s.count('1') > 0 and t.count('1') == 0):
	print('NO')
else:
	print('YES')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
elif s1 == s2:
	print('YES')
elif s1.find('1') == -1:
	print('NO')
elif s2.find('1') == -1:
	print('NO')
else:
	print('YES')


a = input()
b = input()
if len(a) == 1:
	if a == b:
		print('YES')
	else:
		print('NO')
	quit()
(cnta0, cnta1) = (0, 0)
(cntb0, cntb1) = (0, 0)
for i in a:
	if i == '0':
		cnta0 += 1
	else:
		cnta1 += 1
for i in b:
	if i == '0':
		cntb0 += 1
	else:
		cntb1 += 1
if cnta1 == 0 and cntb1 > 0 or (cnta1 > 0 and cntb1 == 0) or len(a) != len(b):
	print('NO')
else:
	print('YES')


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
from itertools import permutations
import heapq
I = sys.stdin.readline
alpha = 'abcdefghijklmnopqrstuvwxyz'
mod = 10 ** 9 + 7

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def isPrime(n):
	if n <= 1:
		return False
	elif n <= 2:
		return True
	else:
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				return False
		return True

def main():
	a = I().strip()
	b = I().strip()
	if len(a) != len(b):
		print('NO')
	else:
		ca = [0, 1][a.count('1') > 0]
		cb = [0, 1][b.count('1') > 0]
		if ca == cb:
			print('YES')
		else:
			print('NO')
main()


s = input()
t = input()
if len(s) != len(t):
	print('NO')
	exit()
b1 = '1' in s
b2 = '1' in t
if b1 == b2:
	print('YES')
else:
	print('NO')


a = input()
b = input()
can = False
if len(a) == len(b):
	la = 0
	lb = 0
	while la < len(a) and a[la] == '0':
		la += 1
	while lb < len(b) and b[lb] == '0':
		lb += 1
	if la < len(a) and lb < len(b) or (la == len(a) and lb == len(b)):
		can = True
if can:
	print('YES')
else:
	print('NO')


import sys
readints = lambda : map(int, input().strip('\n').split())
a = input().strip('\n')
b = input().strip('\n')
(n, m) = (len(a), len(b))
(a0, a1) = (a.count('0'), a.count('1'))
(b0, b1) = (b.count('0'), b.count('1'))
if n != m or (a1 == 0 and b1 > 0) or (a1 > 0 and b1 == 0):
	print('NO')
else:
	print('YES')


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
sys.setrecursionlimit(111111)
INF = 99999999999999999999999999999999

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		a = rs()
		b = rs()
		print('YES' if len(a) == len(b) and '1' in a and ('1' in b) or a == b else 'NO')
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


s = input()
s1 = input()
if len(s) != len(s1):
	print('NO')
	exit()
c = s.count('1')
c1 = s1.count('1')
if c == c1 == 0:
	print('YES')
	exit()
if c == 0 or c1 == 0:
	print('NO')
	exit()
print('YES')


a = input()
b = input()
num = a.find('1') == -1
num2 = b.find('1') == -1
if len(a) == len(b) and num == num2:
	print('YES')
else:
	print('NO')


x = input()
y = input()
a = len(x)
b = len(y)
if a != b:
	print('NO')
	exit()
f = False
s = False
for letter in x:
	if letter == '1':
		f = True
		break
for letter in y:
	if letter == '1':
		s = True
		break
if not f and (not s) or (f and s):
	print('YES')
else:
	print('NO')


def solve(a, b):
	if len(a) != len(b):
		print('NO')
		return
	else:
		hasa = False
		hasb = False
		for i in range(len(a)):
			if a[i] == '1':
				hasa = True
			if b[i] == '1':
				hasb = True
		if hasa == hasb:
			print('YES')
		else:
			print('NO')
a = list(input())
b = list(input())
solve(a, b)


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return sorted(fac)

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
a = input()
b = input()
if len(a) == len(b) and ('1' in a) == ('1' in b):
	print('YES')
else:
	print('NO')


from sys import *
s = input()
r = input()
if len(s) == len(r):
	(g1, g2) = (0, 0)
	for i in s:
		if i == '1':
			g1 = 1
			break
	for i in r:
		if i == '1':
			g2 = 1
			break
	if not g1 ^ g2:
		print('YES')
		exit(0)
print('NO')


(a, b) = (input(), input())
print(['NO', 'YES'][('1' in a and '1' in b or a == b) and len(a) == len(b)])


3
a = input()
b = input()
if len(a) != len(b) or (a.find('1') == -1) ^ (b.find('1') == -1):
	print('NO')
else:
	print('YES')


s = input()
ans = input()
if len(s) != len(ans) or ('1' in ans and '1' not in s) or ('1' not in ans and '1' in s):
	print('NO')
else:
	print('YES')


s1 = input()
s2 = input()
string1 = len(s1)
string2 = len(s2)
a = s1.count('0')
b = s2.count('0')
if string1 != string2:
	print('NO')
elif string1 == a and string2 == b:
	print('YES')
else:
	count1 = 0
	count2 = 0
	for i in s1:
		if i == '0':
			count1 += 1
	for j in s2:
		if j == '0':
			count2 += 1
	if count1 != string1 and count2 != string2:
		print('YES')
	else:
		print('NO')


import sys, threading, os.path
import collections, heapq, math, bisect
import string
from platform import python_version
import itertools
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)

def main():
	if os.path.exists('input.txt'):
		input = open('input.txt', 'r')
	else:
		input = sys.stdin
	s1 = list(str(input.readline().rstrip('\n')))
	s2 = list(str(input.readline().rstrip('\n')))
	if len(s1) != len(s2):
		output = 'NO'
	else:
		(ok1, ok2) = (False, False)
		for i in range(len(s1)):
			if s1[i] == '1':
				ok1 = True
			if s2[i] == '1':
				ok2 = True
		if ok1 == ok2:
			output = 'YES'
		else:
			output = 'NO'
	if os.path.exists('output.txt'):
		open('output.txt', 'w').writelines(str(output))
	else:
		sys.stdout.write(str(output))
main()


import sys, math as mt
import heapq as hp
import collections as cc
import math as mt
import itertools as it
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
s = input()
t = input()
if len(s) != len(t):
	print('NO')
elif '1' in s and '1' not in t:
	print('NO')
elif '1' in t and '1' not in s:
	print('NO')
else:
	print('YES')


s1 = input()
s2 = input()
n1 = len(s1)
n2 = len(s2)
if s1 == s2:
	print('YES')
	exit()
if n1 != n2:
	print('NO')
	exit()
if s1.count('0') == n1 or s2.count('0') == n1:
	print('NO')
	exit()
print('YES')


a = input()
b = input()
n = len(a)
m = len(b)
if n != m:
	print('NO')
elif '1' in a and '1' in b:
	print('YES')
elif '1' not in a and '1' not in b:
	print('YES')
else:
	print('NO')


import sys
(a, b) = (input(), input())
if len(a) != len(b):
	print('NO')
	sys.exit()
if (a.count('1') == 0 or b.count('1') == 0) and a != b:
	print('NO')
else:
	print('YES')


str1 = input()
str2 = input()
if len(str1) != len(str2):
	print('NO')
elif ('1' in str1) ^ ('1' in str2):
	print('NO')
else:
	print('YES')


def main():
	a = str(input())
	b = str(input())
	if len(a) != len(b):
		print('NO')
		return
	if '1' in a and '1' in b:
		print('YES')
		return
	if '1' not in a and '1' not in b:
		print('YES')
		return
	print('NO')
	return
main()


def answer(A, B):
	if len(A) != len(B):
		return 'NO'
	count = 0
	for i in range(len(A)):
		if A[i] == '1':
			count += 1
	for i in range(len(A)):
		if A[i] == '0' and B[i] == '1':
			if count > 0:
				count += 1
			else:
				return 'NO'
		elif A[i] == '1' and B[i] == '0':
			if count > 1:
				count -= 1
			else:
				return 'NO'
	return 'YES'
A = input()
B = input()
print(answer(A, B))


def main():
	(aa, bb) = (input(), input())
	print(('NO', 'YES')[len(aa) == len(bb) and ('1' in aa) == ('1' in bb)])
main()


s = input()
s2 = input()
p1 = len(s)
p2 = len(s2)
if p1 == p2:
	string = p1 * '0'
	if s == string and s2 == string:
		print('YES')
	elif s == string or s2 == string:
		print('NO')
	else:
		print('YES')
else:
	print('NO')


s1 = input()
s2 = input()
if len(s1) == len(s2):
	if s1 == s2:
		print('YES')
	elif s1.count('0') == len(s1) and s2.count('0') != len(s2):
		print('NO')
	elif s1.count('0') != len(s1) and s2.count('0') == len(s2):
		print('NO')
	else:
		print('YES')
else:
	print('NO')


s1 = list(input())
s2 = list(input())
if len(s1) != len(s2):
	print('NO')
else:
	su1 = 0
	su2 = 0
	for i in range(len(s1)):
		su1 += int(s1[i])
		su2 += int(s2[i])
	if su1 + su2 == 0:
		print('YES')
	elif su1 + su2 == max(su1, su2):
		print('NO')
	else:
		print('YES')


(a, b) = (input(), input())
print('YES' if len(a) == len(b) and ('0' in set(a) and '0' in set(b) and (len(set(a)) == len(set(b))) or ('1' in set(a) and '1' in set(b))) and (len(a) > 1 or b[0] == a[0]) else 'NO')


a = list(input())
b = list(input())
print(['YES', 'NO']['1' not in a and '1' in b or ('1' not in b and '1' in a) or len(a) != len(b)])


import sys
import math
import collections
import heapq
import decimal
a = list(input())
n = len(a)
b = list(input())
m = len(b)
if n != m:
	print('NO')
elif a == ['0'] * n and b == ['0'] * n:
	print('YES')
elif a == ['0'] * n or b == ['0'] * n:
	print('NO')
else:
	print('YES')


a = input()
b = input()
cnta = 0
cntb = 0
flag = 0
if len(a) == len(b):
	for i in range(len(a)):
		if a[i] == '1':
			cnta += 1
		if b[i] == '1':
			cntb += 1
	if cnta == 0 and cntb == 0:
		flag = 1
	elif cnta > 0 and cntb > 0:
		flag = 1
if flag == 1:
	print('YES')
else:
	print('NO')


def conv(a, b):
	if len(a) != len(b):
		return False
	if a == b:
		return True
	return not ('1' not in a or '1' not in b)
a = input()
b = input()
if conv(a, b):
	print('YES')
else:
	print('NO')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	x = a.count('1')
	y = b.count('1')
	if x == y:
		print('YES')
	elif x == 0 or y == 0:
		print('NO')
	else:
		print('YES')


from sys import stdin
import math
a = stdin.readline().rstrip()
b = stdin.readline().rstrip()
a_all_zero = all(map(lambda x: x == '0', a))
b_all_zero = all(map(lambda x: x == '0', b))
if len(a) != len(b):
	print('NO')
	exit()
if a == b:
	print('YES')
	exit()
if b_all_zero != a_all_zero:
	print('NO')
	exit()
print('YES')


a = input()
b = input()

def fail():
	print('NO')
	exit()
if len(a) != len(b):
	fail()
if len(a) == 1 and a != b:
	fail()
if '1' not in a and a != b:
	fail()
if '1' not in b and a != b:
	fail()
print('YES')


from collections import defaultdict
from pprint import pprint
import sys
import time
from collections import Counter
from functools import total_ordering, lru_cache
from random import randint
from sys import stderr
from typing import Union
import math
INF = 10 ** 18 + 3
EPS = 1e-10
MAX_CACHE = 10 ** 9

def time_it(function, output=stderr):

	def wrapped(*args, **kwargs):
		start = time.time()
		res = function(*args, **kwargs)
		elapsed_time = time.time() - start
		print('"%s" took %f ms' % (function.__name__, elapsed_time * 1000), file=output)
		return res
	return wrapped

@time_it
def main():
	(a, b) = (input(), input())
	if a == '0' * len(a):
		(a, b) = (b, a)
	res = 'NO' if len(a) != len(b) else 'YES'
	if b == '0' * len(b) and a != b:
		res = 'NO'
	print(res)

def set_input(file):
	global input
	input = lambda : file.readline().strip()

def set_output(file):
	global print
	local_print = print

	def print(*args, **kwargs):
		kwargs['file'] = kwargs.get('file', file)
		return local_print(*args, **kwargs)
set_input(open('input.txt', 'r') if 'MINE' in sys.argv else sys.stdin)
set_output(sys.stdout)
main()


s = input()
t = input()
a = len(s)
b = len(t)
x = []
y = []
if a != b:
	print('NO')
elif s == t:
	print('YES')
elif s.count('0') == a or t.count('0') == b:
	print('NO')
else:
	print('YES')


import sys
import math
import bisect
import itertools
from collections import Counter

def solution(a, b):
	if len(a) != len(b):
		return 'NO'
	if len(a) == 1:
		if a == b:
			return 'YES'
		else:
			return 'NO'
	if a == b:
		return 'YES'
	if b.count('0') == len(b):
		return 'NO'
	if '1' in a:
		return 'YES'
	return 'NO'
a = sys.stdin.readline().strip()
b = sys.stdin.readline().strip()
print(solution(a, b))


S1 = input()
S2 = input()
if len(S1) == len(S2) and (S1.count('1') == 0 and S2.count('1') == 0 or (S1.count('1') != 0 and S2.count('1') != 0)):
	print('YES')
else:
	print('NO')


def func(a, b):
	if len(a) != len(b):
		return 'NO'
	if b.count('1') == a.count('1'):
		return 'YES'
	elif b.count('1') == 0 and a.count('1') > 0:
		return 'NO'
	elif b.count('1') > 0 and a.count('1') == 0:
		return 'NO'
	else:
		return 'YES'
a = input()
b = input()
print(func(a, b))


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
s = input()
n = len(s)
t = input()
m = len(t)

def NO():
	print('NO')
	exit()
if n != m:
	NO()
if '1' in s and '1' not in t or ('1' in t and '1' not in s):
	NO()
print('YES')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
a = input()
b = input()
if len(a) != len(b):
	print('NO')
	exit()
c1 = a.count('1')
for i in range(len(a)):
	if a[i] != b[i]:
		if a[i] == '1':
			if c1 - 1 <= 0:
				print('NO')
				exit()
			c1 -= 1
		else:
			if c1 <= 0:
				print('NO')
				exit()
			c1 += 1
print('YES')


a = input()
b = input()
l1 = len(a)
l2 = len(b)
t1 = '1' in a
t2 = '1' in b
if l1 != l2 or t1 != t2:
	print('NO')
else:
	print('YES')


i = input
(a, b) = (i(), i())
print(['YES', 'NO'][(len(a) != len(b) or set(a) == {'0'} or set(b) == {'0'} or (len(a) < 2)) and a != b])


s = input()
t = input()
if len(s) != len(t):
	print('NO')
	exit(0)
if '1' in s and '1' not in t:
	print('NO')
elif '1' in t and '1' not in s:
	print('NO')
else:
	print('YES')


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor
from bisect import bisect_right, bisect_left, bisect
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def isPowerOfTwo(x):
	return x and (not x & x - 1)
MOD = 1000000007
PMOD = 998244353
N = 10 ** 9 + 7
LOGN = 30
T = 1
for _ in range(T):
	a = str(stdin.readline().strip('\n'))
	b = str(stdin.readline().strip('\n'))
	if len(a) != len(b):
		print('NO')
		continue
	aOk = False
	bOk = False
	for i in range(len(a)):
		if a[i] == '1':
			aOk = True
	for i in range(len(b)):
		if b[i] == '1':
			bOk = True
	if aOk != bOk:
		print('NO')
	else:
		print('YES')


a = input()
b = input()
if a != b and (len(a) != len(b) or a.count('0') == len(a) or b.count('0') == len(b)):
	print('NO')
else:
	print('YES')


def xor(x, y):
	return int(x != y)
a = input()
b = input()
print('YES') if not xor('1' in a, '1' in b) and len(a) == len(b) else print('NO')


def helper(a, b):
	n = len(a)
	m = len(b)
	if n != m:
		return 'NO'
	if a == b:
		return 'YES'
	if a == '0' * n or b == '0' * m:
		return 'NO'
	return 'YES'
a = input()
b = input()
print(helper(a, b))


a = str(input())
b = str(input())
if len(a) != len(b):
	print('NO')
else:
	f = 0
	fa = 0
	fb = 0
	n = len(a)
	for i in range(n):
		if a[i] == '1':
			fa += 1
		if b[i] == '1':
			fb += 1
	if fa == 0 or fb == 0:
		if a != b:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
	exit()
arr1 = [0, 0]
arr2 = [0, 0]
for i in a:
	arr1[int(i)] += 1
for i in b:
	arr2[int(i)] += 1
if arr1[1] == 0 and arr2[1] != 0:
	print('NO')
elif arr1[1] != 0 and arr2[1] == 0:
	print('NO')
else:
	print('YES')


(a, b) = (input(), input())
if len(a) != len(b):
	print('NO')
else:
	(u, v) = (0, 0)
	for i in a:
		if i == '1':
			u = 1
			break
	for i in b:
		if i == '1':
			v = 1
			break
	if u == v:
		print('YES')
	else:
		print('NO')


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
s1 = read_line()
s2 = read_line()
n1 = len(s1)
n2 = len(s2)
f1 = False
f2 = False
if n1 == n2:
	for i in range(n1):
		if s1[i] == '1':
			f1 = True
	for i in range(n1):
		if s2[i] == '1':
			f2 = True
	flag = f1 and f2
	if not flag and s1 != s2:
		print('NO')
	else:
		print('YES')
else:
	print('NO')


from collections import Counter, defaultdict, deque
from operator import itemgetter
import math
import sys
input = sys.stdin.readline

def solve():
	s1 = input().strip()
	s2 = input().strip()
	if len(s1) != len(s2):
		return False
	c1 = s1.count('1')
	c2 = s2.count('1')
	if (c2 == 0) ^ (c1 == 0):
		return False
	return True
tt = 1
for test in range(tt):
	print('YES' if solve() else 'NO')


def cnt(s):
	ret = 0
	for ch in s:
		ret += bool(ch is '1')
	return ret
a = input()
b = input()
(acount, bcount) = [cnt(a), cnt(b)]
if len(a) != len(b):
	print('NO')
elif acount is bcount:
	print('YES')
elif acount > bcount and bcount is not 0:
	print('YES')
elif acount < bcount and acount is not 0:
	print('YES')
else:
	print('NO')


a = input()
b = input()
flag = '0'
tag = '0'
if a == b == '0' * len(a):
	print('YES')
elif len(a) != len(b):
	print('NO')
else:
	for i in range(len(a)):
		if a[i] == '1':
			flag = 1
	if flag == '0':
		print('NO')
	else:
		for i in range(len(a)):
			if b[i] == '1':
				tag = 1
		if tag == '0':
			print('NO')
		else:
			print('YES')


from collections import Counter
l = list(input())
l1 = list(input())
a = Counter(l)
b = Counter(l1)
alen = len(l)
blen = len(l1)
if alen != blen:
	print('NO')
	exit()
if a['1'] <= 0 and b['1'] > 0:
	print('NO')
elif a['1'] > 0 and b['1'] <= 0:
	print('NO')
else:
	print('YES')


from sys import stdin, stdout
import math

def solve():
	a = input()
	b = input()
	(la, lb) = (len(a), len(b))
	if la != lb or (la == lb and la == 1 and (a != b)):
		print('NO')
		return
	if a == b:
		print('YES')
		return
	if a.count('1') == 0 or b.count('0') == lb:
		print('NO')
	else:
		print('YES')
tt = 1
for __ in range(tt):
	solve()


for i1 in range(1):
	s = input()
	l = input()
	if s == l:
		print('YES')
	elif len(s) == len(l) and s.count('1') != 0 and (l.count('1') != 0):
		print('YES')
	else:
		print('NO')


from collections import Counter
s1 = str(input())
s2 = str(input())
if len(s1) != len(s2):
	print('NO')
	quit()
c1 = Counter(s1)
c2 = Counter(s2)
if c1['1'] > 0 and c2['1'] > 0:
	print('YES')
elif c1['1'] == 0 and c2['1'] == 0:
	print('YES')
else:
	print('NO')


(s1, s2) = (input(), input())
if len(s1) != len(s2):
	print('NO')
elif s1 == s2:
	print('YES')
else:
	(s_1, s_2) = (0, 0)
	for j in range(len(s1)):
		if s1[j] == '1':
			s_1 += 1
		if s2[j] == '1':
			s_2 += 1
		if s_1 >= 1 and s_2 >= 1:
			print('YES')
			exit()
	print('NO')


a = input()
b = input()
possible = True
if len(a) != len(b):
	possible = False
elif a == b:
	pass
else:
	if list(a).count('1') == 0:
		possible = False
	if list(b).count('1') == 0:
		possible = False
if possible:
	print('YES')
else:
	print('NO')


import sys
x = sys.stdin.readline().rstrip()
y = sys.stdin.readline().rstrip()
lx = len(x)
ly = len(y)
if lx != ly:
	print('NO')
	exit(0)
if x == y:
	print('YES')
	exit(0)
if lx == 1:
	print('NO')
	exit(0)
if [i for i in x].count('0') == lx or [i for i in y].count('0') == ly:
	print('NO')
else:
	print('YES')


s = input()
t = input()
n1 = len(s)
n2 = len(t)
if n1 != n2:
	print('NO')
else:
	fir = s.count('0')
	sec = t.count('0')
	if fir == n1 and sec != n1 or (sec == n1 and fir != n2):
		print('NO')
	else:
		print('YES')


from collections import defaultdict, Counter
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
slmii = lambda : sorted(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def main():
	a = li()
	b = li()
	if a == b:
		print('YES')
	else:
		n = len(a)
		m = len(b)
		if n == 1 or n != m:
			print('NO')
		elif '1' in a and '1' in b:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


a = input()
b = input()
if len(a) != len(b):
	print('NO')
elif a == b:
	print('YES')
elif len(set(list(a))) == 1 and a[0] == '0':
	print('NO')
elif len(set(list(b))) == 1 and b[0] == '0':
	print('NO')
else:
	print('YES')


import os, sys, math
from io import BytesIO, IOBase
from collections import defaultdict, deque, OrderedDict
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')

def I():
	return int(input())

def In():
	return map(int, input().split())

def ln():
	return list(map(int, input().split()))

def Sn():
	return input().strip()
BUFSIZE = 8192

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return len(a)

def solve():
	a = Sn()
	b = Sn()
	if len(a) != len(b):
		no()
		return
	n = len(a)
	(a1, a0, b1, b0) = (0, 0, 0, 0)
	for i in range(n):
		if a[i] == '1':
			a1 += 1
		else:
			a0 += 1
		if b[i] == '1':
			b1 += 1
		else:
			b0 += 1
	if a1 > 0:
		if b1 == 0:
			no()
		else:
			yes()
	elif b1 != 0:
		no()
	else:
		yes()
	pass

def main():
	T = 1
	for i in range(T):
		solve()
M = 998244353
P = 1000000007

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def possible(s1, s2):
	if len(s1) != len(s2):
		return False
	has11 = False
	for c in s1:
		if c == '1':
			has11 = True
			break
	has12 = False
	for c in s2:
		if c == '1':
			has12 = True
			break
	return has11 == has12
s1 = input()
s2 = input()
if possible(s1, s2):
	print('YES')
else:
	print('NO')


I = input
a = I()
b = I()
C = str.count
print(['NO', 'YES'][len(a) == len(b) and bool(C(b, '1')) == bool(C(a, '1'))])


s1 = ''
s2 = ''
s1 = s1 + input()
s2 = s2 + input()
if len(s1) != len(s2):
	print('NO')
elif s1 == s2:
	print('YES')
elif s2.count('1') == 0 or s1.count('1') == 0:
	print('NO')
else:
	print('YES')


x = list(input())
y = list(input())
if len(x) != len(y):
	print('NO')
	raise SystemExit
if x.count('1') == 0 and y.count('1') == 0:
	print('YES')
	raise SystemExit
if x.count('1') > 0 and y.count('1') > 0:
	print('YES')
	raise SystemExit
print('NO')


ch1 = input()
ch2 = input()
if len(ch1) != len(ch2):
	print('NO')
else:
	nb11 = ch1.count('1')
	nb21 = ch2.count('1')
	if nb11 == 0 and ch1 != ch2 or (nb21 == 0 and ch1 != ch2):
		print('NO')
	else:
		print('YES')


from collections import Counter, defaultdict, OrderedDict, deque
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from typing import List
import itertools
import sys
import math
import heapq
import string
import random
(MIN, MAX, MOD) = (-1061109567, 1061109567, 1000000007)

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
a = input()
b = input()
if a == b:
	print('YES')
elif len(a) != len(b) or '1' not in a or '1' not in b:
	print('NO')
else:
	print('YES')


import sys

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for i in range(1):
	a = input()
	b = input()
	if a == b:
		print('YES')
	elif a.count('1') == 0 or b.count('1') == 0 or len(a) != len(b):
		print('NO')
	else:
		print('YES')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
elif '1' in s1:
	if '1' in s2:
		print('YES')
	else:
		print('NO')
elif '1' in s2:
	print('NO')
else:
	print('YES')


from sys import stdin, stdout
from math import gcd
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for i in range(1):
	a = input()
	b = input()
	na = len(a)
	nb = len(b)
	if na != nb:
		print('NO')
		continue
	if a == b:
		print('YES')
		continue
	if '1' in a and '1' in b:
		print('YES')
		continue
	print('NO')


from collections import Counter, OrderedDict
from itertools import permutations as perm
from fractions import Fraction
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(a, b) = (g(), g())
dec = b.count('1')
if len(a) != len(b):
	print('NO')
elif dec in (0, len(a)):
	if dec:
		print('YES' if '1' in a else 'NO')
	else:
		print('YES' if '1' not in a else 'NO')
elif '1' in a:
	print('YES')
else:
	print('NO')


x = str(input())
y = str(input())
s = True
n = len(x)
m = len(y)
if n == m:
	if n == 1:
		s = x == y
	elif '1' in x:
		s = '1' in y
	else:
		s = x == y
else:
	s = False
if s:
	print('YES')
else:
	print('NO')


a = input()
b = input()
ac = a.count('1')
bc = b.count('1')
if len(a) != len(b):
	print('NO')
	exit()
if len(a) == 1:
	print('YES' if a[0] == b[0] else 'NO')
	exit()
if a == b:
	print('YES')
	exit()
print('YES' if ac != 0 and bc != 0 else 'NO')


s1 = input()
s2 = input()

def isReachable(s1, s2):
	if len(s1) != len(s2):
		return False
	allzero1 = True
	allzero2 = True
	for c in s1:
		if c != '0':
			allzero1 = False
	for c in s2:
		if c != '0':
			allzero2 = False
	return not allzero1 ^ allzero2
if isReachable(s1, s2):
	print('YES')
else:
	print('NO')


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from math import *
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
sys.setrecursionlimit(100000)
a = data()
b = data()
a1 = b1 = 0
if len(a) == len(b):
	for i in range(len(a)):
		if a[i] == '1':
			a1 += 1
		if b[i] == '1':
			b1 += 1
	if a1 == b1 and a1 == 0 or (a1 > 0 and b1 > 0):
		print('YES')
		exit()
print('NO')