C++

Timeloop 发表于 6个月前 · 关联问题 得分

不知道为啥用string会有问题

include iostream

include cstring

using namespace std;

int main(){

int t; char a[80]; int score; int count; cin>>t; for(int i=0;i<t;i++){ cin>>a; count=0; score=0; for(int j=0;j<int(strlen(a));j++){ if(a[j]=='O')count++; else if(a[j]=='X')count=0; else if(a[j]=='\0')break; score+=count; } cout<<score<<endl; } return 0;

}