local S, T = io.read("l","l")
S={string.byte(S,1,#S)}
T={string.byte(T,1,#T)}
local source = {}
for i=1,#S do
    if source[T[i]] == nil then
        source[T[i]] = S[i];
    elseif source[T[i]] ~= S[i] then
        print("No")
        return
    end
end
print("Yes")
