a = list(input()) b = list(input()) a.sort() b.sort() for i in range(len(a)): if a[i] != b[i]: print('NO') break else: print('YES')