A = str(input().rstrip()) B = str(input().rstrip()) A = sorted(A) B = sorted(B) if A == B: print("YES") else: print("NO")