S, T = [eval(input()) for x in range(2)]

max_match_len = 0



for i in range(len(S)):

  if len(S) - len(T) < i:

    break

  compare_s = S[i:i+len(T)]

  match_len = 0

  for j in range(len(T)):

    if compare_s[j] == T[j]:

      match_len += 1

  else:

    if max_match_len < match_len:

      max_match_len = match_len

print((len(T) - max_match_len))


S, T = [eval(input()) for x in range(2)]

lenT = len(T)

max_match_len = 0



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

  compareS = S[i:i+lenT]

  match_len = 0

  for j in range(lenT):

    if compareS[j] == T[j]:

      match_len += 1

  else:

    if max_match_len < match_len:

      max_match_len = match_len

print((lenT - max_match_len))

S, T = [eval(input()) for x in range(2)]
max_match_len = 0
for i in range(len(S)):
    if len(S) - len(T) < i:
        break
    compare_s = S[i : i + len(T)]
    match_len = 0
    for j in range(len(T)):
        if compare_s[j] == T[j]:
            match_len += 1
    else:
        if max_match_len < match_len:
            max_match_len = match_len
print((len(T) - max_match_len))

S, T = [eval(input()) for x in range(2)]
lenT = len(T)
max_match_len = 0
for i in range(len(S) - lenT + 1):
    compareS = S[i : i + lenT]
    match_len = 0
    for j in range(lenT):
        if compareS[j] == T[j]:
            match_len += 1
    else:
        if max_match_len < match_len:
            max_match_len = match_len
print((lenT - max_match_len))

+lenT = len(T) -for i in range(len(S)): -    if len(S) - len(T) < i: -        break -    compare_s = S[i : i + len(T)] +for i in range(len(S) - lenT + 1): +    compareS = S[i : i + lenT] -    for j in range(len(T)): -        if compare_s[j] == T[j]: +    for j in range(lenT): +        if compareS[j] == T[j]: -print((len(T) - max_match_len)) +print((lenT - max_match_len))