# -*- coding: utf-8 -*-
S = input()
judge = [0] * 1
tmp = ''
ans = 0
m = ''

for n in range(0, len(S)):
	m += S[n]
	judge[0] = m

	if ans > len(S) - len(m) + 1:
		print(ans)
		exit()

	for i in range(len(m) + 1, len(S)):
		tmp += S[i]
		
		if tmp == judge[0]:
			break

		if ans > len(S) - len(m) + 1:
			break

		for j in range(len(judge) - 1, len(judge)):
			if judge[j] == tmp:
				break

		else:
			judge.append(tmp)
			tmp = ''
	
	else:
		ans = max(ans, len(judge))
		judge = [0] * 1

print(ans)