from collections import deque

import sys, copy, itertools,heapq

#input = sys.stdin.readline

 

S = eval(input())

T = eval(input())

 

result = float('inf')

for i in range(len(S) - len(T) + 1):

    t = 0

    for j in range(len(T)):

        if S[i + j] != T[j]:

            t += 1

    result = min(result, t)

print(result)
#input = sys.stdin.readline

 

S = eval(input())

T = eval(input())

 

result = float('inf')

for i in range(len(S) - len(T) + 1):

    t = 0

    for j in range(len(T)):

        if S[i + j] != T[j]:

            t += 1

    result = min(result, t)

print(result)
from collections import deque
import sys, copy, itertools, heapq

# input = sys.stdin.readline
S = eval(input())
T = eval(input())
result = float("inf")
for i in range(len(S) - len(T) + 1):
    t = 0
    for j in range(len(T)):
        if S[i + j] != T[j]:
            t += 1
    result = min(result, t)
print(result)

# input = sys.stdin.readline
S = eval(input())
T = eval(input())
result = float("inf")
for i in range(len(S) - len(T) + 1):
    t = 0
    for j in range(len(T)):
        if S[i + j] != T[j]:
            t += 1
    result = min(result, t)
print(result)

-from collections import deque -import sys, copy, itertools, heapq -