first = input() x = first[0] num = [0] ans = [] n = 1 for i in range(1,len(first)): if x == first[i]: n += 1 else: num.append(n) n=1 x = first[i] num.append(n) for i in range(1,len(num)): ans.append(min(num[i-1],num[i])) print(max(ans)*2)