A=str(input()) B=str(input()) print("{}".format("YES" if sorted(A)==sorted(B) else "NO"))