import Control.Applicative
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = solve <$> f <*> f >>= print
  where
    f = head <$> B.words <$> B.getLine

solve :: ByteString -> ByteString -> Int
solve s t = foldl f lt $ take (ls - lt + 1) $ B.tails s
  where
    ls = B.length s
    lt = B.length t
    f cm bs = min cm $ g t bs
    g xs ys = sum $ B.zipWith (\x y -> if x == y then 0 else 1) xs ys
