S = eval(input())

T = eval(input())

ans = len(T)

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

  temp = len(T)

  for num2 in range(len(T)):

    if S[num1+num2] == T[num2]:

      temp -= 1

  if temp < ans:

    ans = temp

print(ans)
S = eval(input())

T = eval(input())

min_change = 10**9

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

  tmp = 0

  for posi_2 in range(len(T)):

    if S[posi_1+posi_2] != T[posi_2]:

      tmp += 1

  min_change = min(tmp, min_change)

print(min_change)
S = eval(input())
T = eval(input())
ans = len(T)
for num1 in range(len(S) - len(T) + 1):
    temp = len(T)
    for num2 in range(len(T)):
        if S[num1 + num2] == T[num2]:
            temp -= 1
    if temp < ans:
        ans = temp
print(ans)

S = eval(input())
T = eval(input())
min_change = 10**9
for posi_1 in range(len(S) - len(T) + 1):
    tmp = 0
    for posi_2 in range(len(T)):
        if S[posi_1 + posi_2] != T[posi_2]:
            tmp += 1
    min_change = min(tmp, min_change)
print(min_change)

-ans = len(T) -for num1 in range(len(S) - len(T) + 1): -    temp = len(T) -    for num2 in range(len(T)): -        if S[num1 + num2] == T[num2]: -            temp -= 1 -    if temp < ans: -        ans = temp -print(ans) +min_change = 10**9 +for posi_1 in range(len(S) - len(T) + 1): +    tmp = 0 +    for posi_2 in range(len(T)): +        if S[posi_1 + posi_2] != T[posi_2]: +            tmp += 1 +    min_change = min(tmp, min_change) +print(min_change)