1. 程式人生 > >uva 1585

uva 1585

cout clu cnblogs push uva i++ namespace cin str

#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