import Data.List
import Control.Monad

someNumberStr :: String -> String -> Int -> String
someNumberStr s1 s2 cnt | cnt < 0 = ""
                        | otherwise  = do
                                        if [s1 !! cnt] == [s2 !! cnt]
                                            then someNumberStr s1 s2 (cnt-1)
                                            else [s1 !! cnt] ++ someNumberStr s1 s2 (cnt-1)
                                        

main = do
    s <- getLine
    t <- getLine
    print $ length $ someNumberStr s t (length(s)-1)