local a = io.read() local b = io.read() function count_chars(str) local tb = {}; do for i = 1, str:len() do local key = str:sub(i, i) if not tb[key] then tb[key] = 1 else tb[key] = tb[key] + 1 end end end return tb end local ans = (function () for key, value in pairs(count_chars(a)) do if not (count_chars(b)[key] == value) then return false end end return true end)() and (function () for key, value in pairs(count_chars(b)) do if not (count_chars(a)[key] == value) then return false end end return true end)() and "YES" or "NO" print(ans)