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