a = input() b = input() if a == b: print("YES") else: for i in range(len(a)): if a.find(b[i]) == -1: print("NO") break if b.find(a[i]) == -1: print("NO") break else: print("YES")