from collections import Counter a = Counter(list(input())) b = Counter(list(input())) if sorted(a.elements()) == sorted(b.elements()): print("YES") else: print("NO")