#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include //#include //#include //#include using namespace std; //#define int long long typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; constexpr ll mod = 998244353; const ll INF = mod * mod; typedef pairP; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i=0;i--) #define Rep(i,sta,n) for(int i=sta;i=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) #define all(v) (v).begin(),(v).end() typedef pair LP; typedef long double ld; typedef pair LDP; const ld eps = 1e-8; const ld pi = acosl(-1.0); ll mod_pow(ll x, ll n, ll m) { if (x >= m)x %= m; ll res = 1; while (n) { if (n & 1)res = res * x % m; x = x * x % m; n >>= 1; } return res; } struct uf { private: vector par, ran; public: uf(int n) { par.resize(n, 0); ran.resize(n, 0); rep(i, n) { par[i] = i; } } int find(int x) { if (par[x] == x)return x; else return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x), y = find(y); if (x == y)return; if (ran[x] < ran[y]) { par[x] = y; } else { par[y] = x; if (ran[x] == ran[y])ran[x]++; } } bool same(int x, int y) { return find(x) == find(y); } }; int dx[8] = { 0,1,1,1,0,-1,-1,-1 }; int dy[8] = { 1,1,0,-1,-1,-1,0,1 }; ll dp[1 << 17][4]; string cww = "cww"; void solve() { dp[0][0] = 1; string s; cin >> s; int n = s.size(); rep(i, n) { rep(j, 4) { dp[i + 1][j] += dp[i][j]; if (j < 3 && s[i] == cww[j]) { dp[i + 1][j + 1] += dp[i][j]; } } } cout << dp[n][3] << "\n"; } signed main() { ios::sync_with_stdio(false); cin.tie(0); //cout << fixed << setprecision(15); //init_f(); //init(); //expr(); //int t; cin >> t; rep(i, t) solve(); return 0; }