from collections import Counter as C print('YES' if C(list(input())) == C(list(input())) else 'NO')