def main(): A = input() B = input() print(get_ans(A,B)) def get_ans(a, b): for s in list(a): if a.count(s) != b.count(s): return "NO" elif s not in b: return "NO" return "YES" if __name__ == '__main__': main()