#include inline long nextInt(void) { long temp; std::cin >> temp; return temp; } int main() { int c1[256] = {}; int c2[256] = {}; std::string str1; std::string str2; bool b = true; std::cin >> str1; std::cin >> str2; for(int i = 0; i < str1.size(); ++i) { ++c1[str1[i]]; } for(int i = 0; i < str2.size(); ++i) { ++c2[str2[i]]; } b = true; for(int i = 0; i < 256; ++i) { if( c1[i] != c2[i] ) { b = false; break; } } if( b ) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } return 0; }