import sys import itertools def resolve(in_): A = next(in_).strip() B = next(in_).strip() a = sorted(A) b = sorted(B) return 'YES' if a == b else 'NO' def main(): ans = resolve(sys.stdin) print(ans) if __name__ == '__main__': main()