func main(text1: String = readLine()!, text2: String = readLine()!) {
    let text2Indices = text2.indices
    let text2Count = text2.count
    var searchText1 = text1
    searchText1.removeLast(text2Count - 1)
    var result = text2Count
    for text1Index in searchText1.indices {
        var difference = 0
        for (i, j) in zip(text1[text1Index...].indices, text2Indices) where text1[i] != text2[j] {
            difference += 1
        }
        if result > difference {
            result = difference
        }
    }
    print(result)
}

main()