A=raw_input()
B=raw_input()
a=list(A)
b=list(B)
a.sort()
b.sort()

if a==b:
    print 'YES'
else:
    print 'NO'