import collections A = list(input()) B = list(input()) cA = collections.Counter(A) cB = collections.Counter(B) for key in cA.keys(): if cA[key] != cB[key]: print('NO') exit() print('YES')