Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    c1[ss]=c1.get(ss,'')+tt
    c2[tt]=c2.get(tt,'')+ss
    
    if len(c1[ss])<2 and len(c2[tt])<2:continue
    if c1[ss].count(tt)==len(c1[ss]) and c2[tt].count(ss)==len(c2[tt]):continue
    else:
        print('No')
        exit()

print('Yes')


Fixed submission:
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    if c1.get(ss) is None:
        c1[ss]=tt
    if c2.get(tt) is None:
        c2[tt]=ss
    if c1[ss]==tt and c2[tt]==ss:continue
    else:
        print('No')
        exit()

print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    c1[ss]=c1.get(ss,'')+tt
    c2[tt]=c2.get(tt,'')+ss
    if len(c1[ss])<2 and len(c2[tt])<2:continue
    if set(c1[ss])=={tt} and set(c2[tt])=={ss}:continue
    else:
        print('No')
        exit()

print('Yes')

Fixed submission:
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    if c1.get(ss) is None:
        c1[ss]=tt
    if c2.get(tt) is None:
        c2[tt]=ss
    if c1[ss]==tt and c2[tt]==ss:continue
    else:
        print('No')
        exit()

print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    c1[ss]=c1.get(ss,'')+tt
    c2[tt]=c2.get(tt,'')+ss
    if len(c1[ss])<2 and len(c2[tt])<2:continue
    if set(c1[ss])==set(tt) and set(c2[tt])==set(ss):continue
    else:
        print('No')
        exit()

print('Yes')


Fixed submission:
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    if c1.get(ss) is None:
        c1[ss]=tt
    if c2.get(tt) is None:
        c2[tt]=ss
    if c1[ss]==tt and c2[tt]==ss:continue
    else:
        print('No')
        exit()

print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    c1[ss]=c1.get(ss,'')+tt
    c2[tt]=c2.get(tt,'')+ss

for ss,tt in zip(c1.values(),c2.values()):
    if len(set(ss))>1 or len(set(tt))>1:
        print('No')
        exit()
else:print('Yes')


Fixed submission:
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    if c1.get(ss) is None:
        c1[ss]=tt
    if c2.get(tt) is None:
        c2[tt]=ss
    if c1[ss]==tt and c2[tt]==ss:continue
    else:
        print('No')
        exit()

print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    c1[ss]=c1.get(ss,'')+tt
    c2[tt]=c2.get(tt,'')+ss
    if len(set(c1[ss]))>1 or len(set(c2[tt]))>1:
        print('No')
        exit()

print('Yes')

Fixed submission:
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    if c1.get(ss) is None:
        c1[ss]=tt
    if c2.get(tt) is None:
        c2[tt]=ss
    if c1[ss]==tt and c2[tt]==ss:continue
    else:
        print('No')
        exit()

print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/16

from collections import Counter

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    c1[ss]=c1.get(ss,'')+tt
    c2[tt]=c2.get(tt,'')+ss
    if len(set(c1[ss]))>1 or len(set(c2[tt]))>1:
        print('No')
        exit()

print('Yes')

Fixed submission:
# 2019/08/16

s=list(input())
t=list(input())

c1={}
c2={}
for ss,tt in zip(s,t):
    if c1.get(ss) is None:
        c1[ss]=tt
    if c2.get(tt) is None:
        c2[tt]=ss
    if c1[ss]==tt and c2[tt]==ss:continue
    else:
        print('No')
        exit()

print('Yes')