if __name__ == '__main__': a = list(input()) b = list(input()) a.sorted() b.sorted() if a == b: print("YES") else: print("NO")