A=sorted(input()) B=sorted(input()) O="NO" if A==B:O="YES" print(O)