N = int(input())
S = input()

dp = [[0]*N for _ in range(N)]

for v in range(N):
    for h in range(N):
        if h == 0 or v == 0:
            if S[v] == S[h]:
                dp[v][h] = min(1, abs(v-h))
        elif S[v] == S[h]:
            dp[v][h] = min(dp[v-1][h-1] + 1, abs(v-h))

ans = 0
for i in range(N):
    tmp = max(dp[i])
    if tmp > ans:
        ans = tmp

print(ans) N = int(input()) N int(input()) int input() input S = input() S input() input [0]*N for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) [0]*N [0] 0 N dp = [[0]*N for _ in range(N)] dp [[0]*N for _ in range(N)] for v in range(N):
    for h in range(N):
        if h == 0 or v == 0:
            if S[v] == S[h]:
                dp[v][h] = min(1, abs(v-h))
        elif S[v] == S[h]:
            dp[v][h] = min(dp[v-1][h-1] + 1, abs(v-h)) v range(N) range N for h in range(N):
        if h == 0 or v == 0:
            if S[v] == S[h]:
                dp[v][h] = min(1, abs(v-h))
        elif S[v] == S[h]:
            dp[v][h] = min(dp[v-1][h-1] + 1, abs(v-h)) h range(N) range N if h == 0 or v == 0:
            if S[v] == S[h]:
                dp[v][h] = min(1, abs(v-h))
        elif S[v] == S[h]:
            dp[v][h] = min(dp[v-1][h-1] + 1, abs(v-h)) h == 0 or v == 0 h == 0 h 0 v == 0 v 0 if S[v] == S[h]:
                dp[v][h] = min(1, abs(v-h))
         S[v] == S[h] S[v] S v S[h] S h dp[v][h] = min(1, abs(v-h)) dp[v][h] [v] dp v h min(1, abs(v-h)) min 1 abs(v-h) abs v-h v h elif S[v] == S[h]:
            dp[v][h] = min(dp[v-1][h-1] + 1, abs(v-h)) S[v] == S[h] S[v] S v S[h] S h dp[v][h] = min(dp[v-1][h-1] + 1, abs(v-h)) dp[v][h] [v] dp v h min(dp[v-1][h-1] + 1, abs(v-h)) min dp[v-1][h-1] + 1 dp[v-1][h-1] [v-1] dp v-1 v 1 h-1 h 1 1 abs(v-h) abs v-h v h ans = 0 ans 0 for i in range(N):
    tmp = max(dp[i])
    if tmp > ans:
        ans = tmp i range(N) range N tmp = max(dp[i]) tmp max(dp[i]) max dp[i] dp i if tmp > ans:
        ans = tmp tmp > ans tmp ans ans = tmp ans tmp print(ans) print ans tmp = max(dp[i]) max(dp[i]) tmp N = int(input()) int(input()) N ans = 0 0 ans ans = tmp tmp ans dp = [[0]*N for _ in range(N)] [[0]*N for _ in range(N)] dp S = input() input() S
N = int(input())
S = input()

dp = [[0]*N for _ in range(N)]

for v in range(N):
    for h in range(N):
        if h == 0 or v == 0:
            if S[v] == S[h]:
                dp[v][h] = min(1, abs(v-h))
        elif S[v] == S[h]:
            dp[v][h] = min(dp[v-1][h-1] + 1, abs(v-h))

ans = 0
for i in range(N):
    tmp = max(dp[i])
    if tmp > ans:
        ans = tmp

print(ans)