import std.algorithm, std.string, std.range, std.stdio, std.conv; ulong factorial(ulong n) { ulong t = 1; for (ulong i; i < n; i++) t *= (n - i); return t; } ulong p(ulong n, ulong r) { ulong t = 1; for (ulong i; i < r; i++) t *= (n - i); return t; } ulong c(ulong n, ulong r) { return p(n, r) / r.factorial; } void main() { string[] cwws = readln.chomp.split(string.init); string cww = "cww"; size_t count; foreach (idx, c; cwws) { if (c.length - 2 < idx) { break; } if (c == "c") { ulong ws = cwws[(idx + 1)..$].filter!(e => e.to!string == "w").count; if (1 < ws) { count += ws.c(2); } else { break; } } else { continue; } } writeln(count); }