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 ps in order[::-1]: xSum = 0 ySum = 0 for p in ps: xSum += xCnt[p] ySum += yCnt[p] if xSum != ySum: return xSum > ySum return False for i in range(2, 20): k = 0 while k < len(order) and gt(i, order[k][0]): k += 1 if k < len(order) and not gt(order[k][0], i): order[k].append(i) else: order.insert(k, [i]) def toCnt2(x): xCnt = toCnt(x) cnt = [0] * len(order) for i in range(len(order)): for p in order[i]: cnt[i] = xCnt[p] return cnt[::-1] order2 = sorted(range(10**5), key=toCnt2) group = [] for v in order2: if len(group) == 0 or toCnt2(group[-1][0]) != toCnt2(v): group.append([v]) else: group[-1].append(v) rank = [0] * 10**5 for i in range(len(group)): for v in group[i]: rank[v] = 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] exit() nCnt = cnt3(input()) mCnt = cnt3(input()) if nCnt < mCnt: print("Yes") else: print("No")