import Counter A = list(input()) B = list(input()) a = Counter(A) b = Counter(B) if a == b: print("YES") else: print("NO")