def replace(A,B): reverse = [] for i in B: for j in A: if i == j: reverse.append(j) break if ''.join(reverse) == ''.join(B): return "YES" else: return "NO" A = list(input()) B = list(input()) print(replace(A,B))