# import sys; input = sys.stdin.buffer.readline # sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): S = input() N = len(S) ans = 0 pre1 = 0 pre2 = INF for i in range(N - 2): if S[i] == "c" and S[i + 1] == "c" and S[i + 2] == "w": pre1 = i + 1 pre2 = min(pre2, N - i - 2) ans = min(pre1, pre2) print(ans) if __name__ == '__main__': main()