s = input() a = [] c = 0 d = 0 for value in range(0,2): a.append(s) while ('ccw' in a[0]) == True: a[0] = a[0].replace('c','',1) c = c + 1 while ('ccw' in a[1]) == True: a[1] = a[1].replace('w','',1) d = d + 1 if c >= d: print(d) else: print(c)