S = input() ans = 200 i1 = i0 = -10000 for i in range(len(S)): if S[i] == 'c': i0 = i else: ans = min(ans, i-i1+1) i1 = i0 if ans == 200: print(-1) else: print(ans)