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.add(n) n=1 x = first[i] for i in range(len(num)): ans.add(min(num[i],num[i+1])) print(max(ans))