s1 = input() s2 = input() for i in range(ord("a"), ord("z") + 1): if s1.count(chr(i)) != s2.count(chr(i)): print("NO") break else: print("YES")