S = eval(input())

T = eval(input())



d1 = dict()

d2 = dict()



ret = "Yes"



for s, t in zip(S, T):

    #print("{}-->{}".format(s, t))

    tmp1 = d1.get(s, None)

    tmp2 = d2.get(t, None)

    if (tmp1 == None or tmp1 == t) and (tmp2 == None or tmp2 == s):

        d1[s] = t

        d2[t] = s

    else:

        ret = "No"



print(ret)

import sys

import collections

import itertools

import math

import re

from collections import Counter

from collections import deque

from collections import defaultdict



S = eval(input())

T = eval(input())





N = len(S)





def f(STR1, STR2):

    d = {}

    isOK = True

    for i in range(N):

        s = STR1[i]

        t = STR2[i]



        if d.get(s) == None:

            d[s] = t

        elif d.get(s) == t:

            pass

        else:

            return False

    return True





if f(S,T) and f(T,S):

    print("Yes")

else:

    print("No")

S = eval(input())
T = eval(input())
d1 = dict()
d2 = dict()
ret = "Yes"
for s, t in zip(S, T):
    # print("{}-->{}".format(s, t))
    tmp1 = d1.get(s, None)
    tmp2 = d2.get(t, None)
    if (tmp1 == None or tmp1 == t) and (tmp2 == None or tmp2 == s):
        d1[s] = t
        d2[t] = s
    else:
        ret = "No"
print(ret)

import sys
import collections
import itertools
import math
import re
from collections import Counter
from collections import deque
from collections import defaultdict

S = eval(input())
T = eval(input())
N = len(S)


def f(STR1, STR2):
    d = {}
    isOK = True
    for i in range(N):
        s = STR1[i]
        t = STR2[i]
        if d.get(s) == None:
            d[s] = t
        elif d.get(s) == t:
            pass
        else:
            return False
    return True


if f(S, T) and f(T, S):
    print("Yes")
else:
    print("No")

+import sys +import collections +import itertools +import math +import re +from collections import Counter +from collections import deque +from collections import defaultdict + -d1 = dict() -d2 = dict() -ret = "Yes" -for s, t in zip(S, T): -    # print("{}-->{}".format(s, t)) -    tmp1 = d1.get(s, None) -    tmp2 = d2.get(t, None) -    if (tmp1 == None or tmp1 == t) and (tmp2 == None or tmp2 == s): -        d1[s] = t -        d2[t] = s -    else: -        ret = "No" -print(ret) +N = len(S) + + +def f(STR1, STR2): +    d = {} +    isOK = True +    for i in range(N): +        s = STR1[i] +        t = STR2[i] +        if d.get(s) == None: +            d[s] = t +        elif d.get(s) == t: +            pass +        else: +            return False +    return True + + +if f(S, T) and f(T, S): +    print("Yes") +else: +    print("No")