S = input() S = S[::-1] ans = 0 w_count = 0 for s in S: if s == 'w': w_count += 1 elif s=='c': ans += w_count*(w_count-1)/2 print('%d' % ans)