from itertools import groupby S = input() G = groupby(S) C = [] for key, group in G: C.append(len(list(group))) ans = 0 for i in range(len(C)-1): ans = max(ans,min(C[i],C[i+1])*2) print(ans)