getSubString :: Int -> String -> [String] -> [String]
getSubString a b c
 | a > (length b) = c
 | otherwise      = getSubString a (tail b) ((take a b):c)

getDiffNum :: Int -> String -> String -> Int
getDiffNum a b c
 | b == []              = a
 | (head b) /= (head c) = getDiffNum (a + 1) (tail b) (tail c) 
 | otherwise            = getDiffNum a (tail b) (tail c) 

main = do
 s <- getLine
 t <- getLine
 print $ minimum $ map (getDiffNum 0 t) $ getSubString (length t) s []