S = input()
T = input()

chageCountMin = len(T)

for i,_ in enumerate(S[:len(S) if len(T) == 1 else -len(T) + 1:]):
	changeCount = 0
	for j,_ in enumerate(T):
		if S[i + j] != T[j]:
			changeCount+=1
	chageCountMin = min(chageCountMin,changeCount)
print(chageCountMin)


#D,T,S = map(int,input().split())
#print('Yes' if D <= T * S else 'No')
#N = int(input())
#A = list(map(int,input().split()))
#Q = int(input())
#B = [0] * Q
#C = [0] * Q

#ans = []

#Adic = {}
#sum = 0
#for n in range(N):
#	sum += A[n]
#	if not A[n] in Adic:
#		Adic[A[n]] = 1
#	else:
#		Adic[A[n]] +=1

#for i in range(Q):
#	B,C = map(int,input().split())
#	if B in Adic:
#		sum = sum - B * Adic[B] + C * Adic[B]
		
#		if C in Adic :
#			Adic[C] += Adic[B]
#		else:
#			Adic[C] = Adic[B]
#		Adic.pop(B)

#	ans.append(sum)

#for a in ans:
#	print(a)



#N = int(input())
#ans = []
#while(N != 0):
#	N -=1
#	ans.append(N % 26)
#	N = N // 26
#ans_str = ''
#for i in range(len(ans)):
#	ans_str+=chr(97 + ans[len(ans) - i - 1])
#print(ans_str)

#N,K = map(int,input().split())
#p = list(map(int,input().split()))
#p.sort()

#print(sum(p[:K]))




#a = input()

#print('a' if a.islower() else 'A')


#N = int(input())
#A = list(map(int, input().split()))

##Adic = {}

##for i in range(N):
##	Adic[A[i]] = i + 1

#Asorted = sorted(A)
#divlist = []
#dup = [x for x in set(Asorted) if Asorted.count(x) > 1]
#Asorterd = set(Asorted)

#count = 0
#for i in range(len(Asorted)):
#	divflag = False
#	#for j in range(i):
#	for div in divlist:
#		#if Asorted[i] % Asorted[i - j - 1] == 0:
#		if Asorted[i] % div == 0:
#			divflag = True
#			break
#	if divflag == False:
#		divlist.append(Asorted[i])

#print(len(set(divlist)-set(dup)))

#X,N = map(int,input().split())
#if N == 0:
#	print(X)
#	exit()

#P = list(map(int,input().split()))

#P.sort()
#for i in range(N):
#	if P[i] > X:
#		print(X)
#		break
#	elif P[i] == X:
#		#下に
#		under = X
#		underflag = False
#		upper = X
#		upperflag = False
#		for j in range(i):
#			if P[i - j - 1] != X - j - 1:
#				under = X - j - 1
#				underflag = True
#				break
#		if underflag == False:
#			under = P[0] - 1

#		for j in range(N - i - 1):
#			if P[i + j + 1] != X + j + 1:
#				upper = X + j + 1
#				upperflag = True
#				break
#		if upperflag == False:
#			upper = P[N - 1] + 1
#		print(under if abs(X - under) <= abs(X - upper) else upper)
#		break



#X,Y = map(int,input().split())
#flag = False

#for i in range(X + 1):
#	if 2 * (i) + 4 * (X - i) == Y:
#		flag = True

#print('Yes' if flag else 'No')




#x = list(map(int, input().split()))

#for i in range(1,6):
#	if x[i - 1] == 0:
#		print(i)
#		break

#def prime_factorize(n):
#    a = []
#    while n % 2 == 0:
#        a.append(2)
#        n //= 2
#    f = 3
#    while f * f <= n:
#        if n % f == 0:
#            a.append(f)
#            n //= f
#        else:
#            f += 2
#    if n != 1:
#        a.append(n)
#    return a

#import collections

#N = int(input())
#A = collections.Counter(prime_factorize(N))

#ans = 0
#for a in A.values():
#	b = 1
#	c = 1
#	while True:
#		if b > a:
#			break
#		c+=1
#		b = b + c
#	ans+=c-1
#print(ans)




#import math

#A,B = input().split()



#C = int(int(A) * float(B) * 100)


#print(C // 100)

#N = int(input())
#As = list(map(int,input().split()))

#sum = 1

#if any(b == 0 for b in As):
#	sum = 0
#else:
#	for a in As:
#		sum*=a
#		if sum > 1000000000000000000:
#			sum = -1
#			break
#print(sum)


#A,B=map(int,input().split())



Measured memory_bytes: 9032