f = list(input()) s = list(input()) f.sort() s.sort() if str(f) == str(s): print('YES') else: print('NO')