import sys
sys.stdin = open('imput.txt', 'rt')
a = input()
b = input()
str1 = [0] * 52  # 대문자 소문자 합쳐서 52개
str2 = [0] * 52

for x in a:
    if x.isupper():
        str1[ord(x) - ord('A')] += 1
    else:
        str1[ord(x) - ord('a') + 26] += 1

for x in b:
    if x.isupper():
        str2[ord(x) - ord('A')] += 1
    else:
        str2[ord(x) - ord('a') + 26] += 1


for i in range(52):
    if str1[i] != str2[i]:
        print('NO')
        break
else:
    print('YES')
0668ff2584665e1bbbe39ca7cd6d23eafa7222b0
<mask token>

<mask token>
for x in a:
    if x.isupper():
        str1[ord(x) - ord('A')] += 1
    else:
        str1[ord(x) - ord('a') + 26] += 1
for x in b:
    if x.isupper():
        str2[ord(x) - ord('A')] += 1
    else:
        str2[ord(x) - ord('a') + 26] += 1
for i in range(52):
    if str1[i] != str2[i]:
        print('NO')
        break
else:
    print('YES')

<mask token>
sys.stdin = open('imput.txt', 'rt')
a = input()
b = input()
str1 = [0] * 52
str2 = [0] * 52
for x in a:
    if x.isupper():
        str1[ord(x) - ord('A')] += 1
    else:
        str1[ord(x) - ord('a') + 26] += 1
for x in b:
    if x.isupper():
        str2[ord(x) - ord('A')] += 1
    else:
        str2[ord(x) - ord('a') + 26] += 1
for i in range(52):
    if str1[i] != str2[i]:
        print('NO')
        break
else:
    print('YES')

import sys
sys.stdin = open('imput.txt', 'rt')
a = input()
b = input()
str1 = [0] * 52
str2 = [0] * 52
for x in a:
    if x.isupper():
        str1[ord(x) - ord('A')] += 1
    else:
        str1[ord(x) - ord('a') + 26] += 1
for x in b:
    if x.isupper():
        str2[ord(x) - ord('A')] += 1
    else:
        str2[ord(x) - ord('a') + 26] += 1
for i in range(52):
    if str1[i] != str2[i]:
        print('NO')
        break
else:
    print('YES')

import sys
sys.stdin = open('imput.txt', 'rt')
a = input()
b = input()
str1 = [0] * 52  # 대문자 소문자 합쳐서 52개
str2 = [0] * 52

for x in a:
    if x.isupper():
        str1[ord(x) - ord('A')] += 1
    else:
        str1[ord(x) - ord('a') + 26] += 1

for x in b:
    if x.isupper():
        str2[ord(x) - ord('A')] += 1
    else:
        str2[ord(x) - ord('a') + 26] += 1


for i in range(52):
    if str1[i] != str2[i]:
        print('NO')
        break
else:
    print('YES')