UVa1585 Score

#include <stdio.h>

int main()
{
    int T, O, score;
    char str[81], *p;
    scanf("%d", &T);
    while (T--)
    {
        scanf("%s", str);
        O = score = 0;
        for (p = str; *p; ++p)
        {
            if (*p == 'O')
            {
                ++O;
                score += O;
            }
            else
            {
                O = 0;
            }
        }
        
        printf("%d\n", score);
    }

    return 0;
}

posted on 2015-06-20 23:34  danny1221  阅读(424)  评论(0编辑  收藏  举报

导航