#include using ll = long long; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string a,b; cin >> a >> b; sort(a.begin(),a.end()); sort(b.begin(),b.end()); if (a==b) cout << "YES\n"; else cout << "NO\n"; return 0; }