-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU a = io.read() b = io.read() ta = {} tb = {} for i = 1, a:len() do ta[i] = a:byte(i) tb[i] = b:byte(i) end table.sort(ta) table.sort(tb) ans = 'YES' for i = 1, a:len() do if ta[i] ~= tb[i] then ans = 'NO' break end end print(ans)