A=input() B=input() for i in A: if (i in(B)) and (A.count(i)==B.count(i)): a="YES" else: a="NO" break print(a)