import Control.Monad
import qualified Data.Map as M

main :: IO ()
main = replicateM 2 getLine >>= putStrLn . solve 

solve :: [String] -> String
solve [s, t]
    | all (\(x, y) -> x == y) xs = "Yes"
    | otherwise = "No"
    where
        xs = zip ys zs
        ys = cvt s
        zs = cvt t
        cvt = fst' . foldr ff ([], 0, M.empty)
        fst' (a, _, _) = a 
        ff x (acc, n, m)
            | M.member x m = (m M.! x : acc, n, m)
            | otherwise = (n : acc, n + 1, M.insert x n m)