local str = io.read() local n = #str local t = {} for i = 1, n + 1 do t[i] = 0 end for i = n, 1, -1 do if(str:sub(i, i) == "w") then t[i] = t[i + 1] + 1 else t[i] = t[i + 1] end end local tot = 0 local cpos = str:find("c") while(cpos ~= nil) do if(2 <= t[cpos]) then tot = tot + math.floor(t[cpos] * (t[cpos] - 1) / 2) end cpos = str:find("c", cpos + 1) end print(tot)