main :: IO ()
main = do
    ss <- getLine
    ts <- getLine
    print $ solve ss ts

solve :: String -> String -> Int
solve ss ts = len - maximum (map (\xs ->
    foldr (\(s, t) acc -> if s == t then acc + 1 else acc) 0 $ zip xs ts) sss)
      where
        sss = snd $ foldr (\_ (n, acc) -> (n + 1, drop n ss : acc)) (0, []) ss
        len = length ts
