n=int(input())
s=input()
dp=[[0]*n for i in range(n)]
for i in range(n-2,-1,-1):
    for j in range(n-1,i,-1):
        if j==n-1:
            if s[j]==s[i]:
                dp[i][j]=1
        else:
            if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
                dp[i][j]=dp[i+1][j+1]+1
            else:
                dp[i][j]=0
ans=0
for i in range(n):
    for j in range(n):
        ans=max(ans,dp[i][j])
print(ans) n=int(input()) n int(input()) int input() input s=input() s input() input [0]*n for i in range(n) for i in range(n) i range(n) range n for i in range(n) [0]*n [0] 0 n dp=[[0]*n for i in range(n)] dp [[0]*n for i in range(n)] for i in range(n-2,-1,-1):
    for j in range(n-1,i,-1):
        if j==n-1:
            if s[j]==s[i]:
                dp[i][j]=1
        else:
            if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
                dp[i][j]=dp[i+1][j+1]+1
            else:
                dp[i][j]=0 i range(n-2,-1,-1) range n-2 n 2 -1 -1 for j in range(n-1,i,-1):
        if j==n-1:
            if s[j]==s[i]:
                dp[i][j]=1
        else:
            if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
                dp[i][j]=dp[i+1][j+1]+1
            else:
                dp[i][j]=0 j range(n-1,i,-1) range n-1 n 1 i -1 if j==n-1:
            if s[j]==s[i]:
                dp[i][j]=1
        else:
            if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
                dp[i][j]=dp[i+1][j+1]+1
            else:
                dp[i][j]=0 j==n-1 j n-1 n 1 if s[j]==s[i]:
                dp[i][j]=1
         s[j]==s[i] s[j] s j s[i] s i dp[i][j]=1 dp[i][j] [i] dp i j 1 if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
                dp[i][j]=dp[i+1][j+1]+1
            else:
                dp[i][j]=0 s[j]==s[i] and dp[i+1][j+1]+1<=j-i s[j]==s[i] s[j] s j s[i] s i dp[i+1][j+1]+1<=j-i dp[i+1][j+1]+1 dp[i+1][j+1] [i+1] dp i+1 i 1 j+1 j 1 1 j-i j i dp[i][j]=dp[i+1][j+1]+1 dp[i][j] [i] dp i j dp[i+1][j+1]+1 dp[i+1][j+1] [i+1] dp i+1 i 1 j+1 j 1 1 dp[i][j]=0 dp[i][j] [i] dp i j 0 ans=0 ans 0 for i in range(n):
    for j in range(n):
        ans=max(ans,dp[i][j]) i range(n) range n for j in range(n):
        ans=max(ans,dp[i][j]) j range(n) range n ans=max(ans,dp[i][j]) ans max(ans,dp[i][j]) max ans dp[i][j] [i] dp i j print(ans) print ans dp=[[0]*n for i in range(n)] [[0]*n for i in range(n)] dp s=input() input() s n=int(input()) int(input()) n ans=0 0 ans ans=max(ans,dp[i][j]) max(ans,dp[i][j]) ans
n=int(input())
s=input()
dp=[[0]*n for i in range(n)]
for i in range(n-2,-1,-1):
    for j in range(n-1,i,-1):
        if j==n-1:
            if s[j]==s[i]:
                dp[i][j]=1
        else:
            if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
                dp[i][j]=dp[i+1][j+1]+1
            else:
                dp[i][j]=0
ans=0
for i in range(n):
    for j in range(n):
        ans=max(ans,dp[i][j])
print(ans)