import collections def main(): word_1 = list(input()) word_2 = list(input()) c1 = collections.Counter(word_1) c2 = collections.Counter(word_2) if c1 == c2: print('YES') else: print('NO') if __name__ == "__main__": main()