#include<bits/stdc++.h>
using namespace std;

vector<int> a(26),b(26);

int main()
{
  string s,t;
  cin>>s>>t;
  for(auto i:s)
    a[i-'a']++;
  for(auto i:t)
    b[i-'a']++;
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  if(a==b)
    cout<<"Yes";
  else
    cout<<"No";
  
  
  return 0;
}
