A = input() B = input() used_chars = set() for i in A: if i not in B or i in used_chars: print("NO") break used_chars.add(i) else: print("YES")