#include <vector>
#include<string>
#include<fstream>
#include<stdlib.h>
using namespace std;
int main()
{
	int d=0;
	ifstream fi("MARK.inp");
	ofstream fo("MARK.out");
	string s;
	getline(fi,s);
	fi.close();
	for(int i=0;i<=s.length();i++)
	{
		if(s[i]=='C')
		{
			int p=1;
			while(s[i]=='C')
			{
				d=d+p;
				p++;
				i++;
			}
		}
	}
	fo<<d;
	fo.close();
}
	
