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

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