main = do
  s <- getLine
  t <- getLine
  print $ compute s t

compute :: String -> String -> Int
compute = loop 0

loop c [] [] = c
loop c (s:ss) (t:tt)
  | s == t = loop c ss tt
  | True   = loop (succ c) ss tt