print('YES' if len({''.join(sorted(input())) for i in range(2)}) == 1 else 'NO')