首页 > 代码库 > uva 1585

uva 1585

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int k;
    cin>>k;
    stack<int> score;
    int t=1;
    string s;
    while(k--)
    {
    t=1;
    cin>>s;
    int len=s.size();
    for(int i=0;i<len;i++)
    {
        if(s[i]==‘O‘)
            score.push(t++);
        if(s[i]==‘X‘)
        {
            t=1;
        }
    }
    int sum=0;
    while(!score.empty())
    {
        sum+=score.top();
        score.pop();
    }
    cout<<sum<<endl;
    }

}

  

uva 1585