main :: IO ()
main = do
  s <- getLine
  t <- getLine
  putStr $ solve s t

solve :: Int -> String -> String -> String
solve 0 _ _ = "No"
solve n (x:xs) ys
  | (x:xs) == ys
    = "Yes"
  | otherwise
    = solve (n - 1) (xs ++ x) ys
  
