def Sort(a,b): A = list(a) B = list(b) aa = sorted(A) bb = sorted(B) return (aa,bb) a = input() b = input() s,t = Sort(a,b) if s == t: print("YES") else: print("NO")