import Data.List (tails)

main :: IO ()
main = do
    n <- read <$> getLine
    s <- getLine
    t <- getLine
    answer $ solve n s t

type Answer = Int
answer :: Answer -> IO ()
answer = print

solve :: Int -> String -> String -> Answer
solve n s t = inner $ zip [0 ..] (tails s)
  where
    isPrefixOf xs ys     = length xs == length (takeWhile id $ zipWith (==) xs ys)
    inner           []   = undefined
    inner ((r, u) : xs)
      | u `isPrefixOf` t = r + length t
      | otherwise        = inner xs
