-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU a = io.read() b = io.read() ta = {} tb = {} for i = 1, 26 do ta[i] = 0 tb[i] = 0 end for i = 1, a:len() do x = a:byte(i) - string.byte('a') + 1 ta[x] = ta[x] + 1 y = b:byte(i) - string.byte('a') + 1 tb[y] = tb[y] + 1 end for i = 1, 26 do if ta[i] ~= tb[i] then print('NO') os.exit() end end print('YES')