{-# LANGUAGE BangPatterns #-}

module Main where

import Control.Applicative
import Control.Monad
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as B

solve :: B.ByteString -> B.ByteString -> Bool
solve ss ts = iter [] [] (B.zip ss ts)
  where
    iter :: [Char] -> [Char] -> [(Char, Char)] -> Bool
    iter _   _   [] = True
    iter !ds !dt ((s, t):us)
        | isNothing ms && isNothing mt = iter (s:ds) (t:dt) us
        | isJust ms && isJust mt       =
            if fromJust ms == fromJust mt
            then iter ds dt us
            else False
        | otherwise                    = False
      where
        ms = s `elemIndex` ds
        mt = t `elemIndex` dt

main :: IO ()
main = do
    ss <- B.getLine
    ts <- B.getLine
    if solve ss ts
        then putStrLn "Yes"
        else putStrLn "No"