#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) string str; ll memo[100010][5] = {}; ll dp(int now, int check){ ll count = 0; if(check == 3) return 1; if(now == str.size()) return 0; if(memo[now][check] != INFLL) return memo[now][check]; if(check == 0){ if(str[now] == 'c'){ count += dp(now + 1, check + 1); } }else if(check == 1 || check == 2){ if(str[now] == 'w'){ count += dp(now + 1, check + 1); } } count += dp(now + 1,check); return memo[now][check] = count; } int main() { for(int i = 0;i < 100010;i++){ for(int j = 0;j < 5;j++){ memo[i][j] = INFLL; } } cin >> str; cout << dp(0, 0) << endl; return 0; }