let s = stdin.ReadLine()
let t = stdin.ReadLine()

let rec solve m n = 
    let l = s.Length - t.Length
    if n = l 
        then (t.Length - m)
        else
            let mutable count = 0
            for i in 0 .. (t.Length - 1) do
                count <- if s.[n + i] = t.[i] then count + 1 else count
            let j = if count > m then count else m
            let np = n + 1
            solve j np

solve 0 0
|> printf "%d"