if __name__ == "__main__": str1 = sorted(input()) str2 = sorted(input()) if str1 == str2: print("YES") else: print("NO")