#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,n,m,x,dem;
	char ch;
	string s,xau;
	vector<int> d(1000000,0);
	ifstream f1("MARK.inp");
	ofstream f2("MARK.out");
	getline(f1,s);
	f1.close();
	int cuoi=s.length();
	if(s[0]=='C') d[0]=1;
	for(i=1;i<=cuoi;i++)
	{
		if((s[i]=='C')&&(s[i-1]=='C'))
		d[i]=d[i-1]+1;
		else
		if((s[i]=='C')&&(s[i-1]=='N'))
		d[i]=1;
	}
	int kq=0;
	for(i=0;i<=cuoi;i++)
	{
		kq=kq+d[i];
		
	}
	f2<<kq;
	f2.close();
	return 0;
}
