s=sorted;i=raw_input;print ['YES','NO'][s(i())!=s(i())]