A = input()
B = input()

if sorted(A) == sorted(B):
    print('YES')
else:
    print('NO')