a=input() b=input() a=sorted(list(a)) b=sorted(list(b)) if a==b: print("YES") else: print("NO")