N = int(eval(input()))

s = eval(input())

t = eval(input())

l = 2*N

kouho = []



for i in range(N):

    ns = s[i:]

    res = 0

    for j, k in zip(ns, t):

        if j == k:

            res += 1

        else:

            break

    kouho.append(res)



print((l - max(kouho)))

N = int(eval(input()))

s = list(eval(input()))

t = list(eval(input()))

N2 = N * 2

ans = 0

for i in range(N):

    temp = 0

    ns = s[i:]

    for j, k in zip(ns, t):

        if j == k:

            temp += 1

        else:

            break

    else:

        ans = max(ans, temp)



print((N2 - ans))
N = int(eval(input()))
s = eval(input())
t = eval(input())
l = 2 * N
kouho = []
for i in range(N):
    ns = s[i:]
    res = 0
    for j, k in zip(ns, t):
        if j == k:
            res += 1
        else:
            break
    kouho.append(res)
print((l - max(kouho)))

N = int(eval(input()))
s = list(eval(input()))
t = list(eval(input()))
N2 = N * 2
ans = 0
for i in range(N):
    temp = 0
    ns = s[i:]
    for j, k in zip(ns, t):
        if j == k:
            temp += 1
        else:
            break
    else:
        ans = max(ans, temp)
print((N2 - ans))

-s = eval(input()) -t = eval(input()) -l = 2 * N -kouho = [] +s = list(eval(input())) +t = list(eval(input())) +N2 = N * 2 +ans = 0 +    temp = 0 -    res = 0 -            res += 1 +            temp += 1 -    kouho.append(res) -print((l - max(kouho))) +    else: +        ans = max(ans, temp) +print((N2 - ans))