You're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least twice. These occurrences can overlap (see sample test 2).
The first input line contains the string. It's guaranteed, that the string is non-empty, consists of lower-case Latin letters, and its length doesn't exceed 100.
s = input() # input the string
n = len(s) # length of the string

res = 0 # length of the longest substring that appears at least twice

# iterate over all possible substrings of length at least 2
for i in range(n-1):
    for j in range(i+1, n):
        # check if the substring s[i:j] appears at least twice in s
        if s[i:j] in s[i+1:]:
            res = max(res, j-i) # update the length of the longest substring found

print(res) # output the length of the longest substring that appears at least twice

		   	   	    		 			  		 					