import sys
# 转换为求两字符串公共子串的最大长度
def maxCommon(s1, s2):
dp = [[0 for _ in range(len(s2) + 1)] for _ in range(len(s1) + 1)]
for i in range(1,len(s1) + 1):
for j in range(1,len(s2) + 1):
if s1[i - 1] == s2[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
return dp[len(s1)][len(s2)]
def func(s): # 输入一个字符串s,字符串长度length(1 ≤ length ≤ 50),字符串只包括小写字符。
ans=0
for i in range(len(s)):
s1=s[:i]
s2=s[i:]
tmp = maxCommon(s1, s2)
ans = max(ans, tmp)
return ans*2 # 输出一个正整数,即满足要求的平方串的长度。
a = sys.stdin.readline()
print(func(a))