#include<bits/stdc++.h>
#define sz(a) static_cast<int>(a.size())
using namespace std;
string s;
int main()
{
    ifstream f1("mk.inp");
    ofstream f2("mk.out");
    getline(f1, s);
    int ans = 0;
    for (int i = 0, cnt = 0; i < sz(s); i++)
        if (s[i] == 'C') ans += ++cnt;
        else cnt = 0;
    f2 << ans;
    f1.close();
    f2.close();
}

