A = input() B = input() alist = list(A) blist = list(B) a = sorted(alist) b = sorted(blist) if a == b: print("YES") else: print("NO")