import math

s = eval(input())

t = eval(input())



alp_s = []

alp_t = []

num_s = []

num_t = []

for i in range(len(s)):

    cnt = 0

    for j in alp_s:

        if s[i] == j:

            num_s[cnt] += 1

        cnt += 1

    if not s[i] in alp_s:

        alp_s.append(s[i])

        num_s.append(1)



    cnt = 0

    for j in alp_t:

        if t[i] == j:

            num_t[cnt] += 1

        cnt += 1

    if not t[i] in alp_t:

        alp_t.append(t[i])

        num_t.append(1)

    

    if num_s != num_t:

        print('No')

        quit()

print('Yes')    
from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

import sys,bisect,math,itertools,fractions,pprint

sys.setrecursionlimit(10**8)

mod = 10**9+7

INF = float('inf')

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))



s = list(eval(input()))

t = list(eval(input()))

ss = [s,t]

n = len(s)

res = [[],[]]

for i in range(2):

    d = defaultdict(int)

    cnt = 1

    for j,x in enumerate(ss[i]):

        if d[x] == 0:

            d[x] = cnt

            cnt += 1

        res[i].append(d[x])

print(('Yes' if res[0] == res[1] else 'No'))
import math

s = eval(input())
t = eval(input())
alp_s = []
alp_t = []
num_s = []
num_t = []
for i in range(len(s)):
    cnt = 0
    for j in alp_s:
        if s[i] == j:
            num_s[cnt] += 1
        cnt += 1
    if not s[i] in alp_s:
        alp_s.append(s[i])
        num_s.append(1)
    cnt = 0
    for j in alp_t:
        if t[i] == j:
            num_t[cnt] += 1
        cnt += 1
    if not t[i] in alp_t:
        alp_t.append(t[i])
        num_t.append(1)
    if num_s != num_t:
        print("No")
        quit()
print("Yes")

from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint

sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


s = list(eval(input()))
t = list(eval(input()))
ss = [s, t]
n = len(s)
res = [[], []]
for i in range(2):
    d = defaultdict(int)
    cnt = 1
    for j, x in enumerate(ss[i]):
        if d[x] == 0:
            d[x] = cnt
            cnt += 1
        res[i].append(d[x])
print(("Yes" if res[0] == res[1] else "No"))

-import math +from collections import Counter, defaultdict, deque +from heapq import heappop, heappush, heapify +import sys, bisect, math, itertools, fractions, pprint -s = eval(input()) -t = eval(input()) -alp_s = [] -alp_t = [] -num_s = [] -num_t = [] -for i in range(len(s)): -    cnt = 0 -    for j in alp_s: -        if s[i] == j: -            num_s[cnt] += 1 -        cnt += 1 -    if not s[i] in alp_s: -        alp_s.append(s[i]) -        num_s.append(1) -    cnt = 0 -    for j in alp_t: -        if t[i] == j: -            num_t[cnt] += 1 -        cnt += 1 -    if not t[i] in alp_t: -        alp_t.append(t[i]) -        num_t.append(1) -    if num_s != num_t: -        print("No") -        quit() -print("Yes") +sys.setrecursionlimit(10**8) +mod = 10**9 + 7 +INF = float("inf") + + +def inp(): +    return int(sys.stdin.readline()) + + +def inpl(): +    return list(map(int, sys.stdin.readline().split())) + + +s = list(eval(input())) +t = list(eval(input())) +ss = [s, t] +n = len(s) +res = [[], []] +for i in range(2): +    d = defaultdict(int) +    cnt = 1 +    for j, x in enumerate(ss[i]): +        if d[x] == 0: +            d[x] = cnt +            cnt += 1 +        res[i].append(d[x]) +print(("Yes" if res[0] == res[1] else "No"))