main :: IO ()
main = do
    s <- getLine
    t <- getLine
    putStrLn $ if solve s t then "Yes" else "No"

solve :: String -> String -> Bool
solve s t = go [] s t
  where
    go _  []       []       = True
    go mp (x : xs) (y : ys) = case lookup y mp of
        Nothing -> go ((y, x) : mp) xs ys
        Just c | c == x    -> go mp xs ys
               | otherwise -> False