f,g=input,sorted;f('YNEOS'[g(f())!=g(f())::2])