import Control.Applicative
import Data.List
strToInt s = (read :: String -> Int) s

main :: IO ()
main = do
    -- ??????????????\???
    s1 <- getLine
    s2 <- getLine
    -- ??????
    putStrLn . show $ levenshteindistance s1 s2

levenshteindistance::String->String->Int
levenshteindistance s1 s2 =
    d!!(length s1)!!(length s2)
    where d = [ [distance m n | n <- [0..length s2]] | m <- [0..length s1]]
          distance i 0 = i
          distance 0 j = j
          distance i j = minimum [d!!(i-1)!!j+1, d!!i!!(j-1)+1, d!!(i-1)!!(j-1) + (if s1!!(i-1) == s2!!(j-1) then 0 else 1)]