N=input() M=input() assert(1<=len(N)) assert(len(N)<=100000) assert(1<=len(M)) assert(len(M)<=100000) assert((N=='0')or(N[0]!='0')) assert((N=='0')or(N[0]!='0')) assert((M=='0')or(M[0]!='0')) P=0 b=0 A=[] for i in range(len(N)-1,-1,-1): if N[i]=='0': b+=1 else: if b==0: P-=1 continue A.append(b) b=0 b=0 B=[] for i in range(len(M)-1,-1,-1): if M[i]=='0': b+=1 else: if b==0: P+=1 continue B.append(b) b=0 def dfs(A,B): if len(A)==0: if len(B)==0: return 0 else: return 1 elif len(B)==0: return -1 P=0 AN=[] BN=[] for i in range(len(A)): x=A[i] b=0 while x>0: if x&1: if b==0: P-=1 else: AN.append(b) b=0 else: b+=1 x>>=1 for i in range(len(B)): x=B[i] b=0 while x>0: if x&1: if b==0: P+=1 else: BN.append(b) b=0 else: b+=1 x>>=1 win=dfs(AN,BN) if win==0: if P==0: return 0 elif P>0: return 1 else: return -1 else: return win win=dfs(A,B) if win==0: if P>0: print('Yes') else: print('No') else: if win==1: print('Yes') else: print('No')