import Text.Printf
import Control.Monad

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

checkRolln ::String->String->Int->Bool
checkRolln (s0:sx) t n = do
    if [s0] ++ sx == t then True
    else if n > 0 then checkRolln (sx ++ [s0]) t (n-1)
    else False

checkRoll ::String->String->Bool
checkRoll s t  = do
    checkRolln s t (length s)
