a=input() b=input() flag=0 for c_a in a: if not(c_a in b): flag=1 break if flag==0 and len(a)==len(b): print("YES") else: print("NO")