stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<cstdio>

#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<string>

#include<map>

#include<set>

using namespace std;

int n,q,t,k,d,ans;

map <char,char> mp,mp2;

const int maxn=1e5+7;

int num[maxn];

bool vis[1000];

int main(){

    string a;

    string b;

    memset(num,-1,sizeof(num));

    cin>>a>>b;

    int len=a.size();

    for(int i=0;i<len;i++)

    {

        if(num[a[i]]==-1)

        {

            num[a[i]]=b[i];

        }

        else

        {

            if(num[a[i]]!=b[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[b[i]]==-1)

        {

            num[b[i]]=a[i];

        }

        else

        {

            if(num[b[i]]!=a[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

	}

// Faster C++ solution for the same problem (measured speedup: 1.4337754787365955x):
#pragma GCC positionimize(3,"Otrst","inline")

//#include "emplace.hpp"

#include<bits/stdc++.h>



using namespace std;

typedef long long ll;

const int N=1e7+10;

const int INF=0x3f3f3f;

const double pi = 3.141592653;

const double E = 2.71828182846;

const ll mod=1e9+7;

const int M=1e3+5;

const double eps=1e-8;

#define ci(x) scanf("%d",&x)

#define co(x) printf("%d\n",x)

inline int read()

{

    int f=1,x=0;

    char c=getchar();

    while(c<'0' || c>'9')

    {

        if(c=='-')

            f=-1;

        c=getchar();

    }

    while(c>='0' && c<='9')

    {

        x=x*10+c-'0';

        c=getchar();

    }

    return f*x;

}

int prime(ll num)

{

    if(num == 1)

        return 0;

    if(num ==2|| num==3 )

        return 1 ;

    if(num %6!= 1&&num %6!= 5)

        return 0 ;

    int tmp =sqrt( num);

    for(int i= 5; i <=tmp; i+=6 )

        if(num %i== 0||num %(i+ 2)==0 )

            return 0 ;

    return 1 ;



}

string s,t;

int a[30];

int b[30];

int main()

{

    cin>>s>>t;

    memset(a,0,sizeof(a));

    memset(b,0,sizeof(b));

    for(int i=0;i<s.size();i++)

    {

        int res=s[i]-'a';

        a[res]++;

    }

    for(int i=0;i<t.size();i++)

    {

        int res=t[i]-'a';

        b[res]++;

    }

    sort(a,a+26);

    sort(b,b+26);

    for(int i=0;i<26;i++)

    {

        if( a[i]!=b[i] )

        {

            printf("No\n");

            return 0;

        }

    }

    printf("Yes\n");

    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<string>

#include<map>

#include<set>

using namespace std;

int n,q,t,k,d,ans;

map <char,char> mp,mp2;

const int maxn=1e5+7;

int num[maxn];

bool vis[1000];

int main(){

    string a;

    string b;

    memset(num,-1,sizeof(num));

    cin>>a>>b;

    int len=a.size();

    for(int i=0;i<len;i++)

    {

        if(num[a[i]]==-1)

        {

            num[a[i]]=b[i];

        }

        else

        {

            if(num[a[i]]!=b[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[b[i]]==-1)

        {

            num[b[i]]=a[i];

        }

        else

        {

            if(num[b[i]]!=a[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

	}

// Faster C++ solution for the same problem (measured speedup: 1.4152822663621263x):


#include <iostream>

#include <algorithm>

#include <string>

#include <array>



using namespace std;



int main(){

    string S, T; cin >> S >> T;

    array<int, 26> Scount, Tcount; Scount.fill(0), Tcount.fill(0);

    for (size_t i = 0; i < S.size(); i++) ++Scount[S[i]-'a'];

    for (size_t i = 0; i < T.size(); i++) ++Tcount[T[i]-'a'];

    sort(Scount.begin(), Scount.end()), sort(Tcount.begin(), Tcount.end());

    (Scount == Tcount) ? cout << "Yes" << endl : cout << "No"  << endl;

    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<string>

#include<map>

#include<set>

using namespace std;

int n,q,t,k,d,ans;

map <char,char> mp,mp2;

const int maxn=1e5+7;

int num[maxn];

bool vis[1000];

int main(){

    string a;

    string b;

    memset(num,-1,sizeof(num));

    cin>>a>>b;

    int len=a.size();

    for(int i=0;i<len;i++)

    {

        if(num[a[i]]==-1)

        {

            num[a[i]]=b[i];

        }

        else

        {

            if(num[a[i]]!=b[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[b[i]]==-1)

        {

            num[b[i]]=a[i];

        }

        else

        {

            if(num[b[i]]!=a[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

	}

// Faster C++ solution for the same problem (measured speedup: 1.4069484765191296x):
#include<bits/stdc++.h>

using namespace std;

int main(void)

{

    string S,T;

    cin>>S>>T;

    vector<int>a1;

    vector<int>b1;

    long long int f,g,i,j,t=0;

    map<char,int>a;

    for(i=0;S[i];i++)

        {f=a[S[i]];

        a[S[i]]++;

        a1.push_back(f+1);}

        sort(a1.begin(),a1.end());

             map<char,int>b;

     for(i=0;T[i];i++)

        {g=b[T[i]];

        b[T[i]]++;

        b1.push_back(g+1);}

        sort(b1.begin(),b1.end());

        for(j=0;j<i;j++)

        {

            if(a1[j]!=b1[j])

                {t=1;

            break;}

        }

       if(t==1)

            cout<<"No";

       else

        cout<<"Yes";



}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<string>

#include<map>

#include<set>

using namespace std;

int n,q,t,k,d,ans;

map <char,char> mp,mp2;

const int maxn=1e5+7;

int num[maxn];

bool vis[1000];

int main(){

    string a;

    string b;

    memset(num,-1,sizeof(num));

    cin>>a>>b;

    int len=a.size();

    for(int i=0;i<len;i++)

    {

        if(num[a[i]]==-1)

        {

            num[a[i]]=b[i];

        }

        else

        {

            if(num[a[i]]!=b[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[b[i]]==-1)

        {

            num[b[i]]=a[i];

        }

        else

        {

            if(num[b[i]]!=a[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

	}

// Faster C++ solution for the same problem (measured speedup: 1.4210783156094502x):
#include <bits/stdc++.h>

using namespace std;

int a[30]={},b[30]={};

int main() {

    string s,t;

    cin >> s >> t;

    for(int i=0;i<s.size();i++){

        int num1=s[i]-'a';

        int num2=t[i]-'a';

        a[num1]++,b[num2]++;

        if(a[num1]!=b[num2]){cout<<"No"; return 0;}

    }

    cout<<"Yes";

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=1e5+7;

int num[maxn];

int main()

{

    string stra;

    string strb;

    cin>>stra>>strb;

    int len=stra.size();

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[stra[i]]==-1)

        {

            num[stra[i]]=strb[i];

        }

        else

        {

            if(num[stra[i]]!=strb[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[strb[i]]==-1)

        {

            num[strb[i]]=stra[i];

        }

        else

        {

            if(num[strb[i]]!=stra[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.542079056686649x):
#include<map>

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int MAXN=200005;

int n;map<char,char>M1,M2;

char c1[MAXN],c2[MAXN];

int main(){

	scanf("%s%s",c1+1,c2+1);

	n=strlen(c1+1);

	for(int i=1;i<=n;i++){

		if(M1[c1[i]]&&M1[c1[i]]!=c2[i]){

			printf("No\n");return 0;

		}

		if(M2[c2[i]]&&M2[c2[i]]!=c1[i]){

			printf("No\n");return 0;

		}

		if(!M1[c1[i]]&&!M2[c2[i]]){

			M1[c1[i]]=c2[i];

			M2[c2[i]]=c1[i];

		}

	}

	printf("Yes\n");

}

/*

abcdefg

bcdefga

*/
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=1e5+7;

int num[maxn];

int main()

{

    string stra;

    string strb;

    cin>>stra>>strb;

    int len=stra.size();

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[stra[i]]==-1)

        {

            num[stra[i]]=strb[i];

        }

        else

        {

            if(num[stra[i]]!=strb[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[strb[i]]==-1)

        {

            num[strb[i]]=stra[i];

        }

        else

        {

            if(num[strb[i]]!=stra[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 7.658653621062482x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;



const int N=200000;



int len;

char s[N+5],t[N+5];

char s1[255],t1[255];



int main()

{

	scanf("%s %s",s+1,t+1);

	len=strlen(s+1);

	for(int i=1;i<=len;i++)

	{

		if( (!s1[s[i]] || s1[s[i]] == t[i]) && (!t1[t[i]] || t1[t[i]] == s[i]))

		{

			s1[s[i]] = t[i];

			t1[t[i]] = s[i];

		}

		else

		{

			puts("No");

			return 0;

		}

	}

	puts("Yes");

	return 0;

}
// Slower C++ solution:
#include<map>

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int MAXN=200005;

int n;map<char,char>M1,M2;

char c1[MAXN],c2[MAXN];

int main(){

	scanf("%s%s",c1+1,c2+1);

	n=strlen(c1+1);

	for(int i=1;i<=n;i++){

		if(M1[c1[i]]&&M1[c1[i]]!=c2[i]){

			printf("No\n");return 0;

		}

		if(M2[c2[i]]&&M2[c2[i]]!=c1[i]){

			printf("No\n");return 0;

		}

		if(!M1[c1[i]]&&!M2[c2[i]]){

			M1[c1[i]]=c2[i];

			M2[c2[i]]=c1[i];

		}

	}

	printf("Yes\n");

}

/*

abcdefg

bcdefga

*/

// Faster C++ solution for the same problem (measured speedup: 4.966446815974574x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;



const int N=200000;



int len;

char s[N+5],t[N+5];

char s1[255],t1[255];



int main()

{

	scanf("%s %s",s+1,t+1);

	len=strlen(s+1);

	for(int i=1;i<=len;i++)

	{

		if( (!s1[s[i]] || s1[s[i]] == t[i]) && (!t1[t[i]] || t1[t[i]] == s[i]))

		{

			s1[s[i]] = t[i];

			t1[t[i]] = s[i];

		}

		else

		{

			puts("No");

			return 0;

		}

	}

	puts("Yes");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=1e5+7;

int num[maxn];

int main()

{

    string stra;

    string strb;

    cin>>stra>>strb;

    int len=stra.size();

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[stra[i]]==-1)

        {

            num[stra[i]]=strb[i];

        }

        else

        {

            if(num[stra[i]]!=strb[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[strb[i]]==-1)

        {

            num[strb[i]]=stra[i];

        }

        else

        {

            if(num[strb[i]]!=stra[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.414527090942243x):
#include <iostream>

#include <string>

#include <map>

using namespace std;

 

int main()

{

  string s, t;

  cin >> s >> t;

 

  map<char, char> map1, map2;

  for(int i = 0; i < s.size(); i++){

    if(map1.find(s[i]) == map1.end()){

      map1[s[i]] = t[i];

    }else{

      if(map1[s[i]] != t[i]){

        cout << "No" << endl;

        return 0;

      }

    }

 

    if(map2.find(t[i]) == map2.end()){

      map2[t[i]] = s[i];

    }else{

      if(map2[t[i]] != s[i]){

        cout << "No" << endl;

        return 0;

      }

    }

  }

 

  cout << "Yes" << endl;

 

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=1e5+7;

int num[maxn];

int main()

{

    string stra;

    string strb;

    cin>>stra>>strb;

    int len=stra.size();

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[stra[i]]==-1)

        {

            num[stra[i]]=strb[i];

        }

        else

        {

            if(num[stra[i]]!=strb[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[strb[i]]==-1)

        {

            num[strb[i]]=stra[i];

        }

        else

        {

            if(num[strb[i]]!=stra[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4117167555908623x):
#include <bits/stdc++.h>

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

#define RALL(a) (a).rbegin(), (a).rend()

#define SZ(a) int((a).size())

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

//#pragma GCC optimize ("-O3") 

#ifdef YANG33

#include "mydebug.hpp"

#else

#define DD(x) 

#endif

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };



/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */

/* ------問題------







-----問題ここまで----- */

/* -----解説等-----







----解説ここまで---- */







int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	string s, t; cin >> s >> t;

	VI from(26, -1), to(26, -1);



	FOR(i, 0, SZ(s)) {

		int f = s[i] - 'a';

		int g = t[i] - 'a';

		if (from[f] != -1 || to[g] != -1) {

			bool ok = true;

			if (from[f] != g) ok = false;

			if (to[g] != f) ok = false;

			if (!ok) {

				cout << "No" << endl;;

				return 0;

			}

		}

		from[f] = g;

		to[g] = f;

	}



	cout << "Yes" << endl;;







	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=1e5+7;

int num[maxn];

int main()

{

    string stra;

    string strb;

    cin>>stra>>strb;

    int len=stra.size();

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[stra[i]]==-1)

        {

            num[stra[i]]=strb[i];

        }

        else

        {

            if(num[stra[i]]!=strb[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[strb[i]]==-1)

        {

            num[strb[i]]=stra[i];

        }

        else

        {

            if(num[strb[i]]!=stra[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4517993687967288x):
#include<iostream>

#include<string.h>

#include<algorithm>

#include<stdio.h>

#include<math.h>

#define maxn 200010

using namespace std;

char a[maxn],b[maxn];

int c[30],d[30];

int main()

{

   int j,len;

   scanf("%s %s",a,b);

   len=strlen(a);

   for(int i=0;i<len;i++)

   {

   	  j=a[i]-'a';

   	 c[j]++;

   }

   len=strlen(b);

   for(int i=0;i<len;i++)

   {

   	  j=b[i]-'a';

   	  d[j]++;

   }

   sort(c,c+30);

   sort(d,d+30);

   for(int i=0;i<30;i++)

   {

   	 if(c[i]!=d[i])

   	 {

   	 	printf("No\n");

   	 	return 0;

		}

   

   }

   printf("Yes\n");

   return 0;

	

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=1e5+7;

int num[maxn];

int main()

{

    string stra;

    string strb;

    cin>>stra>>strb;

    int len=stra.size();

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[stra[i]]==-1)

        {

            num[stra[i]]=strb[i];

        }

        else

        {

            if(num[stra[i]]!=strb[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    memset(num,-1,sizeof(num));

    for(int i=0;i<len;i++)

    {

        if(num[strb[i]]==-1)

        {

            num[strb[i]]=stra[i];

        }

        else

        {

            if(num[strb[i]]!=stra[i])

            {

                cout<<"No"<<endl;

                return 0;

            }

        }

    }

    cout<<"Yes"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4161159163043626x):
// In the name of God



#include <bits/stdc++.h>



using namespace std;



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	string s, t;

	cin >> s >> t;

	vector<int> v1(26, 0), v2(26, 0);

	for(int i = 0; i < s.length(); i++) {

		v1[s[i] - 'a']++;

		v2[t[i] - 'a']++;

	}

	for(int i = 0; i < s.length(); i++) {

		if(v1[s[i] - 'a'] != v2[t[i] - 'a']) {

			cout << "No";

			exit(0);

		}

	}

	cout << "Yes";

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<algorithm>

#include<cstring>

#include<map>

using namespace std;

char s[200002],t[200002];

map<char,char>ms,mt;

int main()

{

	scanf("%s%s",s,t);

	int len=strlen(s);

	for(int i=0;i<len;i++)

		if(ms[s[i]]&&ms[s[i]]!=t[i])

		{

			printf("No");

			return 0;

		}

		else	if(mt[t[i]]&&mt[t[i]]!=s[i])

				{

					printf("No");

					return 0;

				}

				else	if(!ms[s[i]]&&!mt[t[i]])

				{

					ms[s[i]]=t[i];

					mt[t[i]]=s[i];

				}

	printf("Yes");

}

// Faster C++ solution for the same problem (measured speedup: 4.928657505010054x):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

#define N 200010

char s1[N],s2[N];

int a[30],b[30];

int main()

{

    int i,j,k;

    scanf("%s%s",s1,s2);

    k=strlen(s1);

    for(i=0;i<k;i++)

    {

        j=s1[i]-'a';

        a[j]++;

    }

    k=strlen(s2);

    for(i=0;i<k;i++)

    {

        j=s2[i]-'a';

        b[j]++;

    }

    sort(a,a+30);

    sort(b,b+30);

    for(i=0;i<30;i++)

    if(a[i]!=b[i])

    {

        printf("No\n");

        return 0;

    }

    printf("Yes\n");

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<algorithm>

#include<cstring>

using namespace std;

#define MAXN 200000

char s[MAXN+5],t[MAXN+5];

int n;

int Ts[27],Ts2[27];

int main()

{

    scanf("%s%s",s+1,t+1);

    n=strlen(s+1);

    for(int i=1;i<=n;i++)

    {

        int A=s[i]-'a'+1,B=t[i]-'a'+1;

        if(Ts[B]==0)Ts[B]=A;

        else if(Ts[B]!=A){printf("No\n");return 0;}

        if(Ts2[A]==0)Ts2[A]=B;

        else if(Ts2[A]!=B){printf("No\n");return 0;}

    }

    printf("Yes");

}


// Faster C++ solution for the same problem (measured speedup: 5.230144766342325x):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

#define N 200010

char s1[N],s2[N];

int a[30],b[30];

int main()

{

    int i,j,k;

    scanf("%s%s",s1,s2);

    k=strlen(s1);

    for(i=0;i<k;i++)

    {

        j=s1[i]-'a';

        a[j]++;

    }

    k=strlen(s2);

    for(i=0;i<k;i++)

    {

        j=s2[i]-'a';

        b[j]++;

    }

    sort(a,a+30);

    sort(b,b+30);

    for(i=0;i<30;i++)

    if(a[i]!=b[i])

    {

        printf("No\n");

        return 0;

    }

    printf("Yes\n");

    return 0;

}
// Slower C++ solution:
/*Lucky_Glass*/

#include<bits/stdc++.h>

using namespace std;

string A,B;

int totA[26],totB[26];

int main(){

	cin>>A>>B;

	for(int i=0;i<A.length();i++)

		totA[A[i]-'a']++;

	for(int i=0;i<B.length();i++)

		totB[B[i]-'a']++;

	sort(totA,totA+26);

	sort(totB,totB+26);

	for(int i=0;i<26;i++)

		if(totA[i]!=totB[i]){

			printf("No\n");

			return 0;

		}

	printf("Yes");

	return 0;

}//

// Faster C++ solution for the same problem (measured speedup: 5.287879741470817x):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

#define N 200010

char s1[N],s2[N];

int a[30],b[30];

int main()

{

    int i,j,k;

    scanf("%s%s",s1,s2);

    k=strlen(s1);

    for(i=0;i<k;i++)

    {

        j=s1[i]-'a';

        a[j]++;

    }

    k=strlen(s2);

    for(i=0;i<k;i++)

    {

        j=s2[i]-'a';

        b[j]++;

    }

    sort(a,a+30);

    sort(b,b+30);

    for(i=0;i<30;i++)

    if(a[i]!=b[i])

    {

        printf("No\n");

        return 0;

    }

    printf("Yes\n");

    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

#include<algorithm>

#include<cstring>

using namespace std;

const int maxn = 2e5;



char s[maxn + 5];

char t[maxn + 5];

char a[maxn + 5];

char b[maxn + 5];

bool flag;



int main(){

	memset(a, '#', sizeof(a));

	memset(b, '#', sizeof(b));

	scanf("%s", s);

	scanf("%s", t);

	int len = strlen(s);

	for(int i = 0; i <= len - 1; i++){

		if(a[s[i] - 'a'] == '#' || a[s[i] - 'a'] == t[i]){

			a[s[i] - 'a'] = t[i];

		}

		else flag = 1;

		if(b[t[i] - 'a'] == '#' || b[t[i] - 'a'] == s[i]){

			b[t[i] - 'a'] = s[i];

		}

		else flag = 1;

		if(flag){

			printf("No\n");

			return 0;

		}

	}

	printf("Yes\n");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3810542616132713x):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    string s, t;

    cin >> s >> t;

    int i, len = s.size();

    map <char, char> a, b;

    map<char,char>::iterator ita, itb;

    for(i = 0; i < len; i++)

    {

        ita = a.find(s[i]), itb = b.find(t[i]);



        if(ita == a.end() && itb == b.end())

        {

            a.insert({s[i], t[i]});

            b.insert({t[i], s[i]});

        }

        else if(ita == a.end() || itb == b.end())

        {

            printf("No");

            return 0;

        }

        else if(a[s[i]] != t[i] || b[t[i]] != s[i])

        {

            printf("No");

            return 0;

        }

    }

    printf("Yes");

}