UVA刷题方法:https://blog.csdn.net/richenyunqi/article/details/80990535#commentBox
【2019.3.24】
当输入字符时,一定要注意之前遗漏的换行符
#include <iostream>
using namespace std;
int main()
{
int T;
cin>>T;
getchar();
char c;
int num, score;
while(T--) {
num = score = 0;
while((c=getchar()) && (c!='\n')) {
if(c=='O') {
num++;
score+=num;
}
else
num=0;
}
cout<<score<<endl;
}
return 0;
}