A = input() B = input() sort_a = sorted(A) sort_b = sorted(B) if A == B: print('YES') elif len(A) == len(B): for a, b in zip(sort_a, sort_b): if a != b: print('NO') break else: print('YES') else: print('NO')