def main(): a = sorted(input()) b = sorted(input()) if a == b: print('YES') else: print('NO') if __name__ == '__main__': main()