def core(s, t):

  result = len(t)

  for start in range(len(s) - len(t) + 1):

    diff = 0

    for i in range(len(t)):

      if t[i] != s[start + i]:

        diff += 1

    result = min([diff, result])

  

  return result

if __name__ == "__main__":

  strings = [eval(input()) for i in range(2)]

  print((core(strings[0], strings[1])))

def subst(S, T)-> int:

  lenT = len(T)

  result = lenT

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

    # tempS = S[i-lenT:i]

    tempResult = 0

    for j in range(lenT):

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

        tempResult += 1

    if tempResult < result:

      result = tempResult

    

  return result



if __name__ == "__main__":

  S = eval(input())

  T = eval(input())

  print((subst(S, T)))
def core(s, t):
    result = len(t)
    for start in range(len(s) - len(t) + 1):
        diff = 0
        for i in range(len(t)):
            if t[i] != s[start + i]:
                diff += 1
        result = min([diff, result])
    return result


if __name__ == "__main__":
    strings = [eval(input()) for i in range(2)]
    print((core(strings[0], strings[1])))

def subst(S, T) -> int:
    lenT = len(T)
    result = lenT
    for i in range(len(S) - lenT + 1):
        # tempS = S[i-lenT:i]
        tempResult = 0
        for j in range(lenT):
            if T[j] != S[j + i]:
                tempResult += 1
        if tempResult < result:
            result = tempResult
    return result


if __name__ == "__main__":
    S = eval(input())
    T = eval(input())
    print((subst(S, T)))

-def core(s, t): -    result = len(t) -    for start in range(len(s) - len(t) + 1): -        diff = 0 -        for i in range(len(t)): -            if t[i] != s[start + i]: -                diff += 1 -        result = min([diff, result]) +def subst(S, T) -> int: +    lenT = len(T) +    result = lenT +    for i in range(len(S) - lenT + 1): +        # tempS = S[i-lenT:i] +        tempResult = 0 +        for j in range(lenT): +            if T[j] != S[j + i]: +                tempResult += 1 +        if tempResult < result: +            result = tempResult -    strings = [eval(input()) for i in range(2)] -    print((core(strings[0], strings[1]))) +    S = eval(input()) +    T = eval(input()) +    print((subst(S, T)))