#include<iostream>
#include<string>
using namespace std;
int main(){
string str;
cin>>str;
int score(0),goal(0);
int leng=str.length();
for(int i=0;i<leng;i++){
if(str[i]=='O'){
goal++;
score+=goal;
}
else goal=0;
}
cout<<score<<endl;
}