import sys
def solution(a, b):
if len(a) != len(b):
return False
already = {}
for i in range(len(a)):
if a[i] in already.keys():
if already[a[i]] != b[i]:
return False
else:
already[a[i]] = b[i]
return True
if __name__ == '__main__':
read = sys.stdin.readline().strip()
if read:
read = read.split(';')
print(solution(read[0], read[1]))