import collections S=[input() for i in [0,1]] print("YES"if collections.Counter(S[0])==collections.Counter(S[1]) else"NO")