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