from collections import defaultdict order = [0, 1] def toCnt(x): if x == 0:return defaultdict(int) k = 0 while x % 2 == 0: x //= 2 k += 1 tmp = toCnt(x // 2) tmp[k] += 1 return tmp # x > y def gt(x, y): xCnt = toCnt(x) yCnt = toCnt(y) for p in order[::-1]: if xCnt[p] > yCnt[p]: return True if xCnt[p] < xCnt[p]: return False return False for i in range(2, 20): k = 0 while k < len(order) and gt(i, order[k]): k += 1 order.insert(k, i) def toCnt2(x): xCnt = toCnt(x) cnt = [0] * 20 for i in range(20): cnt[order.index(i)] = xCnt[i] return cnt[::-1] order2 = sorted(range(10**5), key=toCnt2) rank = [0] * (10**5) for i in range(10**5): rank[order2[i]] = i def cnt3(N): nCnt = [0] * (10 ** 5) if(N == '0'): return nCnt nOne = [] for i in range(len(N)): if(N[i] == '1'): nOne.append(i) nOne.append(len(N)) for i in range(len(nOne) - 1): nCnt[rank[nOne[i+1] - nOne[i] - 1]] += 1 return nCnt[::-1] nCnt = cnt3(input()) mCnt = cnt3(input()) if nCnt < mCnt: print("Yes") else: print("No")