S = eval(input())

T = eval(input())



l = len(S)



ad_list = [[] for i in range(l)]

ad_list2 = [[] for i in range(l)]



al_dict = {}

al_dict2 = {}



for i, moji in enumerate(S):

    if moji not in al_dict:

        al_dict[moji] = i

    else:

        ad_list[al_dict[moji]].append(i)



for i, moji in enumerate(T):

    if moji not in al_dict2:

        al_dict2[moji] = i

    else:

        ad_list2[al_dict2[moji]].append(i)



if ad_list==ad_list2:

    print('Yes')

else:

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

    l = len(S)

    ad_list = [[] for i in range(l)]

    al_dict = {}



    for i, moji in enumerate(S):

        if moji not in al_dict:

            al_dict[moji] = i

        else:

            ad_list[al_dict[moji]].append(i)

    

    return ad_list



S = eval(input())

T = eval(input())



ad_list = ad_list_gen(S)

ad_list2 = ad_list_gen(T)

if ad_list==ad_list2:

    print('Yes')

else:

    print('No')
S = eval(input())
T = eval(input())
l = len(S)
ad_list = [[] for i in range(l)]
ad_list2 = [[] for i in range(l)]
al_dict = {}
al_dict2 = {}
for i, moji in enumerate(S):
    if moji not in al_dict:
        al_dict[moji] = i
    else:
        ad_list[al_dict[moji]].append(i)
for i, moji in enumerate(T):
    if moji not in al_dict2:
        al_dict2[moji] = i
    else:
        ad_list2[al_dict2[moji]].append(i)
if ad_list == ad_list2:
    print("Yes")
else:
    print("No")

def ad_list_gen(S):
    l = len(S)
    ad_list = [[] for i in range(l)]
    al_dict = {}
    for i, moji in enumerate(S):
        if moji not in al_dict:
            al_dict[moji] = i
        else:
            ad_list[al_dict[moji]].append(i)
    return ad_list


S = eval(input())
T = eval(input())
ad_list = ad_list_gen(S)
ad_list2 = ad_list_gen(T)
if ad_list == ad_list2:
    print("Yes")
else:
    print("No")

+def ad_list_gen(S): +    l = len(S) +    ad_list = [[] for i in range(l)] +    al_dict = {} +    for i, moji in enumerate(S): +        if moji not in al_dict: +            al_dict[moji] = i +        else: +            ad_list[al_dict[moji]].append(i) +    return ad_list + + -l = len(S) -ad_list = [[] for i in range(l)] -ad_list2 = [[] for i in range(l)] -al_dict = {} -al_dict2 = {} -for i, moji in enumerate(S): -    if moji not in al_dict: -        al_dict[moji] = i -    else: -        ad_list[al_dict[moji]].append(i) -for i, moji in enumerate(T): -    if moji not in al_dict2: -        al_dict2[moji] = i -    else: -        ad_list2[al_dict2[moji]].append(i) +ad_list = ad_list_gen(S) +ad_list2 = ad_list_gen(T)