S = eval(input())

T = eval(input())

MIS = len(S)

for TS in range(0,len(S)-len(T)+1):

    LS = S[TS:TS+len(T)]

    Count = 0

    for TT in range(0,len(T)):

        if LS[TT]!=T[TT]:

            Count += 1

    MIS = min(MIS,Count)

print(MIS)
S = eval(input())

T = eval(input())

MIS = len(S)

for TS in range(0,len(S)-len(T)+1):

    LS = S[TS:TS+len(T)]

    Count = sum(True if LS[TT]!=T[TT] else False for TT in range(0,len(T)))

    MIS = min(MIS,Count)

print(MIS)
S = eval(input())
T = eval(input())
MIS = len(S)
for TS in range(0, len(S) - len(T) + 1):
    LS = S[TS : TS + len(T)]
    Count = 0
    for TT in range(0, len(T)):
        if LS[TT] != T[TT]:
            Count += 1
    MIS = min(MIS, Count)
print(MIS)

S = eval(input())
T = eval(input())
MIS = len(S)
for TS in range(0, len(S) - len(T) + 1):
    LS = S[TS : TS + len(T)]
    Count = sum(True if LS[TT] != T[TT] else False for TT in range(0, len(T)))
    MIS = min(MIS, Count)
print(MIS)

-    Count = 0 -    for TT in range(0, len(T)): -        if LS[TT] != T[TT]: -            Count += 1 +    Count = sum(True if LS[TT] != T[TT] else False for TT in range(0, len(T)))