S = eval(input())

T = eval(input())



#ad_list = [[] for i in range(26)]

#ad_list2 = [[] for i in range(26)]

num = 97

al_dict = {}

al_dict2 = {}

new = ''

new2 = ''

for i, moji in enumerate(S):

    if moji not in al_dict:

        al_dict[moji] = i

        new += chr(num)

        num += 1

    else:

        new += new[al_dict[moji]]



num = 97



for i, moji in enumerate(T):

    if moji not in al_dict2:

        al_dict2[moji] = i

        new2 += chr(num)

        num += 1

    else:

        new2 += new2[al_dict2[moji]]



if new==new2:

    print('Yes')

else:

    print('No')
def norm_s(S):

    num = 97

    al_dict = {}

    new = ''

    for i, moji in enumerate(S):

        if moji not in al_dict:

            al_dict[moji] = i

            new += chr(num)

            num += 1

        else:

            new += new[al_dict[moji]]

    

    return new



S = eval(input())

T = eval(input())



new = norm_s(S)

new2 = norm_s(T)

if new==new2:

    print('Yes')

else:

    print('No')
S = eval(input())
T = eval(input())
# ad_list = [[] for i in range(26)]
# ad_list2 = [[] for i in range(26)]
num = 97
al_dict = {}
al_dict2 = {}
new = ""
new2 = ""
for i, moji in enumerate(S):
    if moji not in al_dict:
        al_dict[moji] = i
        new += chr(num)
        num += 1
    else:
        new += new[al_dict[moji]]
num = 97
for i, moji in enumerate(T):
    if moji not in al_dict2:
        al_dict2[moji] = i
        new2 += chr(num)
        num += 1
    else:
        new2 += new2[al_dict2[moji]]
if new == new2:
    print("Yes")
else:
    print("No")

def norm_s(S):
    num = 97
    al_dict = {}
    new = ""
    for i, moji in enumerate(S):
        if moji not in al_dict:
            al_dict[moji] = i
            new += chr(num)
            num += 1
        else:
            new += new[al_dict[moji]]
    return new


S = eval(input())
T = eval(input())
new = norm_s(S)
new2 = norm_s(T)
if new == new2:
    print("Yes")
else:
    print("No")

+def norm_s(S): +    num = 97 +    al_dict = {} +    new = "" +    for i, moji in enumerate(S): +        if moji not in al_dict: +            al_dict[moji] = i +            new += chr(num) +            num += 1 +        else: +            new += new[al_dict[moji]] +    return new + + -# ad_list = [[] for i in range(26)] -# ad_list2 = [[] for i in range(26)] -num = 97 -al_dict = {} -al_dict2 = {} -new = "" -new2 = "" -for i, moji in enumerate(S): -    if moji not in al_dict: -        al_dict[moji] = i -        new += chr(num) -        num += 1 -    else: -        new += new[al_dict[moji]] -num = 97 -for i, moji in enumerate(T): -    if moji not in al_dict2: -        al_dict2[moji] = i -        new2 += chr(num) -        num += 1 -    else: -        new2 += new2[al_dict2[moji]] +new = norm_s(S) +new2 = norm_s(T)