object Main {
  def main(args: Array[String]): Unit = {
    val str       = scala.io.StdIn.readLine
    val check_str = scala.io.StdIn.readLine
    var min_change = 10000000
    ( 0 until ( str.length - check_str.length + 1 ) ).foreach{ i=>
      var change_num = 0
      ( 0 until check_str.length ).foreach{ j =>
        if( str( i + j ) != check_str( j ) ) change_num += 1
      }
      if( change_num < min_change ) min_change = change_num
    }
 
    println( min_change )
  }
}