s = eval(input())

t = eval(input())



s2t = dict()

t2s = dict()



flg = True

for i, (ss, tt) in enumerate(zip(s, t)):

    a = s2t.get(ss, None)

    if a is None:

        s2t[ss] = tt

    else:

        if a != tt:

            flg = False

            break



    b = t2s.get(tt, None)

    if b is None:

        t2s[tt] = ss

    else:

        if b != ss:

            flg = False

            break

print(('Yes' if flg else 'No'))

def solve():

    s = eval(input())

    t = eval(input())

    d = dict()

    for sc, tc in zip(s, t):

        if d.get(sc, None) is None:

            d[sc] = tc

        else:

            if d[sc] != tc:

                return False



    d = {value: key for key, value in list(d.items())}

    for sc, tc in zip(s, t):

        if d.get(tc, None) is None:

            d[tc] = sc

        else:

            if d[tc] != sc:

                return False

    return True





if __name__ == '__main__':

    print(('Yes' if solve() else 'No'))

s = eval(input())
t = eval(input())
s2t = dict()
t2s = dict()
flg = True
for i, (ss, tt) in enumerate(zip(s, t)):
    a = s2t.get(ss, None)
    if a is None:
        s2t[ss] = tt
    else:
        if a != tt:
            flg = False
            break
    b = t2s.get(tt, None)
    if b is None:
        t2s[tt] = ss
    else:
        if b != ss:
            flg = False
            break
print(("Yes" if flg else "No"))

def solve():
    s = eval(input())
    t = eval(input())
    d = dict()
    for sc, tc in zip(s, t):
        if d.get(sc, None) is None:
            d[sc] = tc
        else:
            if d[sc] != tc:
                return False
    d = {value: key for key, value in list(d.items())}
    for sc, tc in zip(s, t):
        if d.get(tc, None) is None:
            d[tc] = sc
        else:
            if d[tc] != sc:
                return False
    return True


if __name__ == "__main__":
    print(("Yes" if solve() else "No"))

-s = eval(input()) -t = eval(input()) -s2t = dict() -t2s = dict() -flg = True -for i, (ss, tt) in enumerate(zip(s, t)): -    a = s2t.get(ss, None) -    if a is None: -        s2t[ss] = tt -    else: -        if a != tt: -            flg = False -            break -    b = t2s.get(tt, None) -    if b is None: -        t2s[tt] = ss -    else: -        if b != ss: -            flg = False -            break -print(("Yes" if flg else "No")) +def solve(): +    s = eval(input()) +    t = eval(input()) +    d = dict() +    for sc, tc in zip(s, t): +        if d.get(sc, None) is None: +            d[sc] = tc +        else: +            if d[sc] != tc: +                return False +    d = {value: key for key, value in list(d.items())} +    for sc, tc in zip(s, t): +        if d.get(tc, None) is None: +            d[tc] = sc +        else: +            if d[tc] != sc: +                return False +    return True + + +if __name__ == "__main__": +    print(("Yes" if solve() else "No"))