#include using namespace std; int main(){ string A,B; cin >> A >> B; while(!A.empty()){ if(B.find(A.back())!=string::npos) B.erase(B.begin()+B.find(A.back())); else{ cout << "NO" << endl; return 0; } A.pop_back(); } cout << "YES" << endl; return 0; }