s = list(input()) t = list(input()) s.sort() t.sort() print("YES" if s == t else "NO")