import sys

import os

import math

import string



ii = lambda: int(sys.stdin.buffer.readline().rstrip())

il = lambda: list(map(int, sys.stdin.buffer.readline().split()))

fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))

iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]



iss = lambda: sys.stdin.buffer.readline().decode().rstrip()

sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))

isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]



lcm = lambda x, y: x * y / math.gcd(x, y)



MOD = 10 ** 9 + 7

MAX = float('inf')





def main():

    if os.getenv("LOCAL"):

        sys.stdin = open("input.txt", "r")



    S = list(iss())

    T = list(iss())

    StoT = {}

    TtoS = {}

    for n in range(ord('a'), ord('z') + 1):

        StoT[chr(n)] = 0

        TtoS[chr(n)] = 0



    for st in zip(S, T):

        s, t = st

        if StoT[s] == 0 and TtoS[t] == 0:

            StoT[s] = t

            TtoS[t] = s

        elif StoT[s] != t or TtoS[t] != s:

            print('No')

            exit()

    else:

        print('Yes')





if __name__ == '__main__':

    main()

import sys

import os

import math

import bisect

import collections

import itertools



ii = lambda: int(sys.stdin.buffer.readline().rstrip())

il = lambda: list(map(int, sys.stdin.buffer.readline().split()))

fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))

iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]



iss = lambda: sys.stdin.buffer.readline().decode().rstrip()

sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))

isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]



lcm = lambda x, y: x * y / math.gcd(x, y)



MOD = 10 ** 9 + 7

MAX = float('inf')





def main():

    if os.getenv("LOCAL"):

        sys.stdin = open("input.txt", "r")



    S = collections.Counter(iss())

    T = collections.Counter(iss())



    if sorted(S.values()) == sorted(T.values()):

        print('Yes')

    else:

        print('No')





if __name__ == '__main__':

    main()

import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]
lcm = lambda x, y: x * y / math.gcd(x, y)
MOD = 10**9 + 7
MAX = float("inf")


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")
    S = list(iss())
    T = list(iss())
    StoT = {}
    TtoS = {}
    for n in range(ord("a"), ord("z") + 1):
        StoT[chr(n)] = 0
        TtoS[chr(n)] = 0
    for st in zip(S, T):
        s, t = st
        if StoT[s] == 0 and TtoS[t] == 0:
            StoT[s] = t
            TtoS[t] = s
        elif StoT[s] != t or TtoS[t] != s:
            print("No")
            exit()
    else:
        print("Yes")


if __name__ == "__main__":
    main()

import sys
import os
import math
import bisect
import collections
import itertools

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]
lcm = lambda x, y: x * y / math.gcd(x, y)
MOD = 10**9 + 7
MAX = float("inf")


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")
    S = collections.Counter(iss())
    T = collections.Counter(iss())
    if sorted(S.values()) == sorted(T.values()):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

-import string +import bisect +import collections +import itertools -    S = list(iss()) -    T = list(iss()) -    StoT = {} -    TtoS = {} -    for n in range(ord("a"), ord("z") + 1): -        StoT[chr(n)] = 0 -        TtoS[chr(n)] = 0 -    for st in zip(S, T): -        s, t = st -        if StoT[s] == 0 and TtoS[t] == 0: -            StoT[s] = t -            TtoS[t] = s -        elif StoT[s] != t or TtoS[t] != s: -            print("No") -            exit() +    S = collections.Counter(iss()) +    T = collections.Counter(iss()) +    if sorted(S.values()) == sorted(T.values()): +        print("Yes") -        print("Yes") +        print("No")