const fs = require('fs') function main(input: string): void { const [one, two] = input.split('\n') const oneSorted = one.split('').sort().join('') const twoSorted = two.split('').sort().join('') const res = oneSorted === twoSorted ? 'YES' : 'NO' console.log(res) } main(fs.readFileSync('/dev/stdin', 'utf8'))