""" from decimal import Decimal import sys import bisect # 二分探索 import numpy as np # 色々 import queue import math import copy import heapq # priキュー from itertools import product # bit全 from collections import deque # deque from collections import defaultdict # C++でいうmap from functools import lru_cache # メモ化再帰 MOD = int(1e9+7) INF = 1<<60 PI = math.pi sys.setrecursionlimit(10**9) # 再帰上限 d=deque() #deque Objects #q=queue.Queue() #queue Objects #q=queue.LifoQueue() #stack Objects #@lru_cache(maxsize=None) # メモ化再帰 def mapint(): return map(int,input().split()) def mapfloat(): return map(float,input().split()) def listint(): return list(map(int,input().split())) def listfloat(): return list(map(float,input().split())) # 素因数分解 def primefactor(N): ans=[] for i in range(2,int(math.sqrt(N))+1): while N%i==0: ans.append(i) N//=i if 2<=N: ans.append(N) return ans # 素数判定 def prime(N): if N<2: return False for i in range(2,int(math.sqrt(N))+1): if N%i==0: return False return True # 約数列挙 def factor(N): ans=[] for i in range(1,int(math.sqrt(N))+1): if N%i!=0: continue ans.append(i) if i!=N//i: ans.append(N//i) return ans # 一次元座標圧縮 def compress(A): B=copy.copy(A) B.sort() B=list(dict.fromkeys(B)) ans=[0]*len(A) for i in range(len(A)): ans[i]=bisect.bisect_left(B,A[i]) return ans # 最大公約数 def gcd(A,B): if B==0: return A return gcd(B,A%B) # 最小公倍数 def lcm(A,B): return int(A/gcd(A,B)*B) """ S=input() T=input() S=sorted(S) T=sorted(T) if S==T: print("YES") else: print("NO")