Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc110/tasks/abc110_c

s = list(str(input()))
t = list(str(input()))
flag = 'Yes'
jskip = []
l = len(s)
for i in range(l):
    f = True
    for j in range(len(jskip)):
        if jskip[j] == s[i]:
            f = False
            break
    if f == True:
        for j in range(l):
            if s[i] == s[j] and t[i] != t[j]:
                flag = 'No'
                break
            elif t[i] == t[j] and s[i] != s[j]:
                flag = 'No'
                break
            elif s[i] == s[j] and t[i] == t[j]:
                jskip.append(s[i])
            if flag == 'No':
                break
    if flag == 'No':
        break

print(flag)


Fixed submission:
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc110/tasks/abc110_c

s = list(str(input()))
t = list(str(input()))
flag = 'Yes'
jskip = []
for i in range(len(s)):
    f = True
    for j in range(len(jskip)):
        if jskip[j] == s[i]:
            f = False
            break
    if f == True:
        for j in range(i+1, len(s)):
            if s[i] == s[j] and t[i] != t[j]:
                flag = 'No'
                break
            elif t[i] == t[j] and s[i] != s[j]:
                flag = 'No'
                break
            elif s[i] == s[j] and t[i] == t[j]:
                jskip.append(s[i])
    if flag == 'No':
        break

print(flag)


Fixed submission:
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
s = list(str(input()))
t = list(str(input()))
flag = 'Yes'
for i in range(len(s)):
    for j in range(i):
        if s[i] == s[j] and t[i] != t[j]:
            flag = 'No'
            break
        elif t[i] == t[j] and s[i] != s[j]:
            flag = 'No'
            break
        if flag == 'No':
            break
    if flag == 'No':
        break

print(flag)

Fixed submission:
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc110/tasks/abc110_c

s = list(str(input()))
t = list(str(input()))
flag = 'Yes'
jskip = []
for i in range(len(s)):
    f = True
    for j in range(len(jskip)):
        if jskip[j] == s[i]:
            f = False
            break
    if f == True:
        for j in range(i+1, len(s)):
            if s[i] == s[j] and t[i] != t[j]:
                flag = 'No'
                break
            elif t[i] == t[j] and s[i] != s[j]:
                flag = 'No'
                break
            elif s[i] == s[j] and t[i] == t[j]:
                jskip.append(s[i])
    if flag == 'No':
        break

print(flag)


Fixed submission:
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc110/tasks/abc110_c

s = list(str(input()))
t = list(str(input()))
u = []
v = []
flag = 'Yes'


for i in range(len(s)):
    for j in range(i+1, len(s)):
        if s[i] == s[j] and t[i] != t[j]:
            flag = 'No'
            break
        elif t[i] == t[j] and s[i] != s[j]:
            flag = 'No'
            break
    if flag == 'No':
        break

print(flag)


Fixed submission:
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc110/tasks/abc110_c

s = list(str(input()))
t = list(str(input()))
u = []
v = []
flag = 'Yes'


for i in range(len(s)):
    for j in range(i, len(s)):
        if s[i] == s[j]:
            if t[i] != t[j]:
                flag = 'No'
                break
        if t[i] == t[j]:
            if s[i] != s[j]:
                flag = 'No'
                break
    if flag == 'No':
        break


print(flag)

Fixed submission:
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc110/tasks/abc110_c

s = list(str(input()))
t = list(str(input()))
u = []
v = []
flag = 'Yes'
cnt = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        if s[i] == s[j]:
            cnt += 1
    u.append(cnt)
    cnt = 0

cnt = 0
for i in range(len(t)):
    for j in range(i, len(t)):
        if t[i] == t[j]:
            cnt += 1
    v.append(cnt)
    cnt = 0
    if u[len(v) - 1] != v[len(v) - 1]:
        flag = 'No'
        break


print(flag)

Fixed submission:
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc110/tasks/abc110_c

s = list(str(input()))
t = list(str(input()))
u = []
v = []
cnt = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        if s[i] == s[j]:
            cnt += 1
    u.append(cnt)
    cnt = 0

cnt = 0
for i in range(len(t)):
    for j in range(i, len(t)):
        if t[i] == t[j]:
            cnt += 1
    v.append(cnt)
    cnt = 0

flag = 'Yes'
for i in range(len(u)):
    if u[i] != v[i]:
        flag = 'No'
        break

print(flag)

Fixed submission:
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc110/tasks/abc110_c

s = list(str(input()))
t = list(str(input()))
u = []
v = []
cnt = 0
for i in range(len(s)):
    for j in range(len(s)):
        if s[i] == s[j]:
            cnt += 1
    u.append(cnt)
    cnt = 0

cnt = 0
for i in range(len(t)):
    for j in range(len(t)):
        if t[i] == t[j]:
            cnt += 1
    v.append(cnt)
    cnt = 0

flag = 'Yes'
for i in range(len(u)):
    if u[i] != v[i]:
        flag = 'No'
        break

print(flag)
'''
cnt = 1
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        cnt += 1
    else:
        u.append(cnt)
        cnt = 1
    if i == len(s) - 1:
        u.append(cnt)

cnt = 1
for i in range(1, len(t)):
    if t[i] == t[i - 1]:
        cnt += 1
    else:
        v.append(cnt)
        cnt = 1
    if i == len(t) - 1:
        v.append(cnt)

print(u)
print(v)

flag = 'Yes'
if len(u) == len(v):
    for i in range(len(u)):
        if u[i] != v[i]:
            flag = 'No'
else:
    flag = 'No'

print(flag)
'''
'''
if flag == 'Yes':
    for i in range(len(s)):
        f = False
        for j in range(len(t)):
            if s[i] == t[j]:
                f = True
                break
        if f == False:
            flag = 'No'
            print(i)
            break

print(flag)
'''


Fixed submission:
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')