#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
string a, b;
cin >> a >> b;
sort(a.begin(), a.end());
sort(b.begin(), b.end());
cout << (a == b ? "YES" : "NO");
return 0;
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluKCkgewoJc3RyaW5nIGEsIGI7CgljaW4gPj4gYSA+PiBiOwoJc29ydChhLmJlZ2luKCksIGEuZW5kKCkpOwkKCXNvcnQoYi5iZWdpbigpLCBiLmVuZCgpKTsKCWNvdXQgPDwgKGEgPT0gYiA/ICJZRVMiIDogIk5PIik7CglyZXR1cm4gMDsKfQ==