def strtolist(s): lst = [] for i in range(0, len(s)): lst.append(s[i]) return lst def judge(a, b): if a == b: return 'YES' else: return 'NO' a = strtolist(raw_input()) a.sort() b = strtolist(raw_input()) b.sort() print judge(a, b)