#include #include #include using namespace std; int main(int argc, char const* argv[]) { string a, b; cin >> a >> b; bool a_eq_b_flag = true; string::iterator a_itr = a.begin(); for (int i = 0; i < b.size(); i++) { string::iterator a_judge = find(a_itr, a.end(), b[i]); if (a_judge == a.end()) { a_eq_b_flag = false; break; } else { char tmp; tmp = a[i]; a[i] = *a_judge; *a_judge = tmp; a_itr++; } } if (a_eq_b_flag) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }