s1 = list(input()) s2 = list(input()) s1 = sorted(s1) s2 = sorted(s2) for i in range(len(s1)): if s1[i]!=s2[i]: print("NO") break else: print("YES")