class Solution:
def longestRepeatingSubstring(self, s: str) -> int:
n = len(s)
dp_table = [[0] * n for _ in range(n)]
max_length = 0
for i in range(n):
for j in range(i + 1, n):
if s[i] == s[j]:
dp_table[i][j] = dp_table[i - 1][j - 1] + 1 if i else 1
max_length = max(max_length, dp_table[i][j])
return max_length