# coding: utf-8 # Your code here! A = input().strip() B = input().strip() countA = {} countB = {} for a in A: if not a in countA: countA[a] = 1 else: countA[a] += 1 for b in B: if not b in countB: countB[b] = 1 else: countB[b] += 1 if countA == countB: print("YES") else: print("NO")