s1 = sorted(list(input())) s2 = sorted(list(input())) if s1!=s2: print("NO") else: print("YES")