a=input() b=input() import collections c=collections.Counter(a) d=collections.Counter(b) if c==d: print("YES") else: print("NO")