n = int(input())
s = input()
Z = [0 for _ in range(n)]
ans = 0
for begin in range(n):
    Z[begin] = n-begin
    i = begin + 1
    j = 0
    while i < n:
        while i+j < n and s[begin+j] ==s[i+j]:
            j += 1
        Z[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < n and k+Z[begin+k] < j:
            Z[i+k] = Z[begin+k]
            k += 1
        i += k
        j -= k
    for i in range(begin,n):
        l = min(i-begin,Z[i])
        ans = max(ans,l)
print(ans) n = int(input()) n int(input()) int input() input s = input() s input() input 0 for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) 0 Z = [0 for _ in range(n)] Z [0 for _ in range(n)] ans = 0 ans 0 for begin in range(n):
    Z[begin] = n-begin
    i = begin + 1
    j = 0
    while i < n:
        while i+j < n and s[begin+j] ==s[i+j]:
            j += 1
        Z[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < n and k+Z[begin+k] < j:
            Z[i+k] = Z[begin+k]
            k += 1
        i += k
        j -= k
    for i in range(begin,n):
        l = min(i-begin,Z[i])
        ans = max(ans,l) begin range(n) range n Z[begin] = n-begin Z[begin] Z begin n-begin n begin i = begin + 1 i begin + 1 begin 1 j = 0 j 0 while i < n:
        while i+j < n and s[begin+j] ==s[i+j]:
            j += 1
        Z[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < n and k+Z[begin+k] < j:
            Z[i+k] = Z[begin+k]
            k += 1
        i += k
        j -= k
     i < n i n while i+j < n and s[begin+j] ==s[i+j]:
            j += 1
         i+j < n and s[begin+j] ==s[i+j] i+j < n i+j i j n s[begin+j] ==s[i+j] s[begin+j] s begin+j begin j s[i+j] s i+j i j j += 1 j 1 Z[i] = j Z[i] Z i j if j == 0:
            i += 1
            continue
         j == 0 j 0 i += 1 i 1 continue k = 1 k 1 while i+k < n and k+Z[begin+k] < j:
            Z[i+k] = Z[begin+k]
            k += 1
         i+k < n and k+Z[begin+k] < j i+k < n i+k i k n k+Z[begin+k] < j k+Z[begin+k] k Z[begin+k] Z begin+k begin k j Z[i+k] = Z[begin+k] Z[i+k] Z i+k i k Z[begin+k] Z begin+k begin k k += 1 k 1 i += k i k j -= k j k for i in range(begin,n):
        l = min(i-begin,Z[i])
        ans = max(ans,l) i range(begin,n) range begin n l = min(i-begin,Z[i]) l min(i-begin,Z[i]) min i-begin i begin Z[i] Z i ans = max(ans,l) ans max(ans,l) max ans l print(ans) print ans j -= k k j Z = [0 for _ in range(n)] [0 for _ in range(n)] Z k += 1 1 k i += 1 1 i j += 1 1 j ans = max(ans,l) max(ans,l) ans i += k k i s = input() input() s l = min(i-begin,Z[i]) min(i-begin,Z[i]) l j = 0 0 j n = int(input()) int(input()) n ans = 0 0 ans i = begin + 1 begin + 1 i k = 1 1 k
n = int(input())
s = input()
Z = [0 for _ in range(n)]
ans = 0
for begin in range(n):
    Z[begin] = n-begin
    i = begin + 1
    j = 0
    while i < n:
        while i+j < n and s[begin+j] ==s[i+j]:
            j += 1
        Z[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < n and k+Z[begin+k] < j:
            Z[i+k] = Z[begin+k]
            k += 1
        i += k
        j -= k
    for i in range(begin,n):
        l = min(i-begin,Z[i])
        ans = max(ans,l)
print(ans)
