a = input() b = input() a_s = "".join(sorted(a)) b_s = "".join(sorted(b)) print("YES") if a_s==b_s else print("NO")