a = input() b = input() sorted_a = "".join(sorted(a)) sorted_b = "".join(sorted(b)) if sorted_a == sorted_b: print("YES") else: print("NO")