#coding: UTF-8 import sys from math import pi from collections import deque from functools import reduce ### defs ### ### main ### A = sys.stdin.readline().strip('\r\n') B = sys.stdin.readline().strip('\r\n') a = [c for c in A] b = [c for c in B] a.sort() b.sort() ans = {True:'YES',False:'NO'} print(ans[a==b])