import collections A=list(input()) B=list(input()) c_A=collections.Counter(A) c_B=collections.Counter(B) if c_A==c_B: print('YES') else: print('NO')