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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int MAXN=2e5+5;

char s[MAXN],t[MAXN];

int c[256+5],d[256+5];

 

int main() 

{

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

	int len=strlen(s);

	memset(c,-1,sizeof c);

	memset(d,-1,sizeof d);

	set<char> cnt;

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

		cnt.insert(s[i]);

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

		if(c[t[i]]!=-1&&c[t[i]]!=s[i]) {

			if(t[i]==s[i]&&cnt.size()<=26)

				continue;

			puts("No");

			return 0;

		}

		c[t[i]]=s[i];

	}

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

		if(d[s[i]]!=-1&&d[s[i]]!=t[i]) {

			if(t[i]==s[i]&&cnt.size()<=26)

				continue;

			puts("No");

			return 0;

		}

		d[s[i]]=t[i];

	}

	puts("Yes");

	return 0;

}

 

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

#include<cstring>

using namespace std;

#define L 200005



char s[L],t[L];

int len,last[30];

int lasts[L],lastt[L];

bool flag=true;



int main() {

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

	len=strlen(s);

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

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

		lasts[i]=last[j];

		last[j]=i;

	}

	memset(last,0,sizeof(last));

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

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

		lastt[i]=last[j];

		last[j]=i;

	}

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

		if(lasts[i]!=lastt[i]) {

			printf("No\n");

			return 0;

		}

	printf("Yes\n");

	return 0;

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

#include <string>

#include <stdio.h>



using namespace std;



int main() {

    string s, t;

    while (cin >> s >> t) {

        int len = s.size(), i;

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

            if (s.find(s[i]) != t.find(t[i])) break;

        }

        if(i < len) puts("No");

        else puts("Yes");

    }

    return 0;

}


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

#include <string.h>

#include <algorithm>



using namespace std;



#define N 210000



int a[30], b[30];

char s1[N], s2[N];



int main() {

    while (scanf("%s", s1) != EOF) {

        scanf("%s", s2);

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

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

        int i, n = strlen(s1);

        for (i = 0; i < n; ++i) {

            a[s1[i] - 'a']++;

            b[s2[i] - 'a']++;

        }

        sort(a, a + 26); sort(b, b + 26);

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

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

        }

        if (i < 26) puts("No");

        else puts("Yes");

    }

    return 0;

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

#include<vector>



using namespace std;



bool solve(string s, string t) {

    vector<int> v[26];

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

        v[s[i] - 'a'].push_back(i);

    }

    int table[200001] = {0};

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

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

    }

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

        if ((int)v[i].size() == 0) continue;

        int c = table[v[i][0]];

        for (int j = 1; j < (int)v[i].size(); ++j) {

            if (table[v[i][j]] != c) {

                return 0;

            }

        }

    }

    return 1;

}

int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    string s, t;

    cin >> s >> t;

    if (solve(s, t) + solve(t, s) == 2) cout << "Yes" << endl;

    else cout << "No" << endl;

}

/*

 sの同じ文字のindex列とtのそれが一致すればいい

 

 */


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

#include<string>

#include<algorithm>



using namespace std;



int main() {

    string S, T;

    cin >> S >> T;

    int s[26] = {0}, t[26] = {0};

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

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

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

    }

    sort(s, s + 26);

    sort(t, t + 26);

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

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

            cout << "No" << endl;

            return 0;

        }

    }

    cout << "Yes" << endl;

}

/*

 aaabb

 abaab

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

#include<vector>



using namespace std;



bool solve(string s, string t) {

    vector<int> v[26];

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

        v[s[i] - 'a'].push_back(i);

    }

    int table[200001] = {0};

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

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

    }

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

        if ((int)v[i].size() == 0) continue;

        int c = table[v[i][0]];

        for (int j = 1; j < (int)v[i].size(); ++j) {

            if (table[v[i][j]] != c) {

                return 0;

            }

        }

    }

    return 1;

}

int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    string s, t;

    cin >> s >> t;

    if (solve(s, t) + solve(t, s) == 2) cout << "Yes" << endl;

    else cout << "No" << endl;

}

/*

 sの同じ文字のindex列とtのそれが一致すればいい

 

 */


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

using namespace std;

typedef long long ll;

#define F first

#define S second

#define pii pair<int, int>

#define mp make_pair

#define eb emplace_back

#define all(v) v.begin(), v.end()

#define rep(i, n) for (int i = 0; i < (n); ++i)

#define rep3(i, l, n) for (int i = l; i < (n); ++i)

#define sz(v) (int)v.size()

#define inf (int)(1e9+7)

#define abs(x) (x >= 0 ? x : -(x))

template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T> inline T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }







bool solve() {

    string s, t;

    cin >> s >> t;

    int r[26], rd[26];

    fill_n(r, 26, -1);

    fill_n(rd, 26, -1);

    

    rep(i, sz(s)) {

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

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

        

        if (r[a] < 0) r[a] = b;

        else if (r[a] != b) return 0;

        

        if (rd[b] < 0) rd[b] = a;

        else if (rd[b] != a) return 0;

        

    }

    

    return 1;

}

int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    

    cout << (solve() ? "Yes" : "No") << endl;

}
// 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.4177095136189586x):
#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;

int num[1000];

bool vis[1000];

int main(){

    string a;

    string b;

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

    cin>>a>>b;

    for(int i=0;i<a.size();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<a.size();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;

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

#include<cstring>

#include<string>

#include<map>

#include<iostream>



using namespace std;



string S,T;



map <char,char> mu;

map <char,char> pu;



int main()

{

	cin >> S;

	cin >> T;

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

		if(mu.count(S[i])){

			if(mu[S[i]] != T[i]) {

				printf("No\n");

				return 0;

			}

		}

		if(pu.count(T[i])) {

			if(pu[T[i]] != S[i]) {

				printf("No\n");

				return 0;

			}

		}

		mu[S[i]] = T[i];

		pu[T[i]] = S[i];

	}

	printf("Yes\n");

}

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

#include<stdlib.h>

#include<string.h>

const int N=200005;

struct node

{

	char a;

	char b;

}stringss[N];

int inc1(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    return m.a-n.a;

}

int inc2(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    return m.b-n.b;

}

int main()

{

	char str1[N],str2[N];

	scanf("%s",str1);

	scanf("%s",str2);

	int len=strlen(str1);

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

	{

		stringss[i].a=str1[i];

		stringss[i].b=str2[i];

	}

	qsort(stringss,len,sizeof(struct node),inc1);

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

	{

		if(stringss[i].a==stringss[i+1].a&&stringss[i].b!=stringss[i+1].b)

		{

			printf("No\n");

			return 0;

		}

	}

	qsort(stringss,len,sizeof(struct node),inc2);

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

	{

		if(stringss[i].b==stringss[i+1].b&&stringss[i].a!=stringss[i+1].a)

		{

			printf("No\n");

			return 0;

		}

	}

	printf("Yes\n");

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

#include <string>

#include <vector>

#include <map>

#include <algorithm>

using namespace std;



int change[26][26];



int main()

{

    string s, t;



    map<char, int> rep1, rep2;

    cin >> s >> t;

    for (auto &c : s)

    {

        rep1[c]++;

    }

    vector<int> mapOfS;

    for (auto &a : rep1)

    {

        mapOfS.push_back(a.second);

    }

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



    for (auto &c : t)

    {

        rep2[c]++;

    }

    vector<int> mapOfT;

    for (auto &a : rep2)

    {

        mapOfT.push_back(a.second);

    }

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



    if (mapOfS == mapOfT)

    {

        cout << "Yes";

    }

    else

    {

        cout << "No";

    }

}

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

#include<stdlib.h>

#include<string.h>

const int N=200005;

struct node

{

	char a;

	char b;

}stringss[N];

int inc1(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    return m.a-n.a;

}

int inc2(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    return m.b-n.b;

}

int main()

{

	char str1[N],str2[N];

	scanf("%s",str1);

	scanf("%s",str2);

	int len=strlen(str1);

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

	{

		stringss[i].a=str1[i];

		stringss[i].b=str2[i];

	}

	qsort(stringss,len,sizeof(struct node),inc1);

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

	{

		if(stringss[i].a==stringss[i+1].a&&stringss[i].b!=stringss[i+1].b)

		{

			printf("No\n");

			return 0;

		}

	}

	qsort(stringss,len,sizeof(struct node),inc2);

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

	{

		if(stringss[i].b==stringss[i+1].b&&stringss[i].a!=stringss[i+1].a)

		{

			printf("No\n");

			return 0;

		}

	}

	printf("Yes\n");

}
// 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: 7.205160582329569x):
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

const int N=200005;

struct node

{

	char a;

	char b;

}stringss[N];

int inc1(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    return m.a-n.a;

}

int inc2(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    return m.b-n.b;

}

int main()

{

	char str1[N],str2[N];

	scanf("%s",str1);

	scanf("%s",str2);

	int len=strlen(str1);

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

	{

		stringss[i].a=str1[i];

		stringss[i].b=str2[i];

	}

	qsort(stringss,len,sizeof(struct node),inc1);

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

	{

		if(stringss[i].a==stringss[i+1].a&&stringss[i].b!=stringss[i+1].b)

		{

			printf("No\n");

			return 0;

		}

	}

	qsort(stringss,len,sizeof(struct node),inc2);

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

	{

		if(stringss[i].b==stringss[i+1].b&&stringss[i].a!=stringss[i+1].a)

		{

			printf("No\n");

			return 0;

		}

	}

	printf("Yes\n");

}
// 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;

int num[1000];

bool vis[1000];

int main(){

    string a;

    string b;

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

    cin>>a>>b;

    for(int i=0;i<a.size();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<a.size();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: 5.082254519077819x):
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

const int N=200005;

struct node

{

	char a;

	char b;

}stringss[N];

int inc1(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    return m.a-n.a;

}

int inc2(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    return m.b-n.b;

}

int main()

{

	char str1[N],str2[N];

	scanf("%s",str1);

	scanf("%s",str2);

	int len=strlen(str1);

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

	{

		stringss[i].a=str1[i];

		stringss[i].b=str2[i];

	}

	qsort(stringss,len,sizeof(struct node),inc1);

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

	{

		if(stringss[i].a==stringss[i+1].a&&stringss[i].b!=stringss[i+1].b)

		{

			printf("No\n");

			return 0;

		}

	}

	qsort(stringss,len,sizeof(struct node),inc2);

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

	{

		if(stringss[i].b==stringss[i+1].b&&stringss[i].a!=stringss[i+1].a)

		{

			printf("No\n");

			return 0;

		}

	}

	printf("Yes\n");

}
// 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.45010132201708x):
#include <iostream>

#include <cstdio>

using namespace std;

const int maxn = 200001;

void read(char a[], int &lena)

{

	char c = getchar();

	while (c < 'a' || c > 'z')

		c = getchar();

	while (c >= 'a' && c <= 'z')

		a[++lena] = c, c = getchar();

}

char a[maxn], b[maxn], x, y;

bool vis[maxn], flag = true;

int lena, lenb;

int main()

{

	read(a, lena), read(b, lenb);

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

	{

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

		{

			x = a[i], y = b[i];

			for (int j = 1; j <= lena; j++)

				if (a[j] == x)

					if (vis[j])

					{

						flag = false;

						break;

					}

					else

						a[j] = y;

				else if (a[j] == y)

					if (vis[j])

					{

						flag = false;

						break;

					}

					else

						a[j] = x;

		}

		vis[i] = true;

		if (!flag)

			break;

	}

	if (flag)

		printf("Yes");

	else

		printf("No");

	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.426305607990318x):
#include<algorithm>

#include<iostream>

using namespace std;

const int N=50;

int temp1[N],temp2[N],m[N],n[N];

int main()

{

	string s,t;

	cin>>s>>t;

	int len1=s.size(),len2=t.size();

	int count1=0,count2=0;

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

	{

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

	}

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

	{

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

	}

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

	{

		m[count1++]=temp1[i];

		n[count2++]=temp2[i];

	}

	sort(temp1,temp1+count1);

	sort(temp2,temp2+count2);

	if(count2!=count1)

	{

		cout<<"No"<<endl;

	}

	bool flag=0;

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

	{

		if(temp2[i]!=temp1[i])

		{

			flag=1;

			break;

		}

	}

	if(flag)cout<<"No"<<endl;

	else {

		cout<<"Yes"<<endl;

	}

}
// 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.4387259704928217x):
#include <iostream>

#include <fstream>

#include <cmath>

#include <algorithm>

#include <vector>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <cstdlib>

#include <cstdio>

#include <string>

#include <cstring>

#include <cassert>

#include <utility>

#include <iomanip>

#include <chrono>

#include <random>

#include <bitset>



using namespace std;



#define sz(x) (int) x.size()

#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())

#define all(a) a.begin(), a.end()

#define sqr(x) ((x) * (x)) 

#define y1 aksjdaskdjksjfksdjf

#define left kdnvldvoiwejifejg

#define right lkdsjflksdjfdjfk

#define prev asdasfsadjkjsdfjs

#define tm aklsjdasjdasjdkdjjf

#define lcm hddalkwjeidjjhasda

#define random_shuffle asdasdd



string s, t;

int mp[500], mpb[500];

int cnt;



int main() { 



  getline(cin, s);

  getline(cin, t);



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

    if ((mp[s[i]] && mp[s[i]] != t[i]) || (mpb[t[i]] && mpb[t[i]] != s[i])) {

      puts("No");

      return 0;

    }

    mp[s[i]] = t[i];

    mpb[t[i]] = s[i];

  }

  

  puts("Yes");



  return 0;

}