​   There is an objective test result such as “OOXXOXXOOO”. An ‘O’ means a correct answer of a problem and an ‘X’ means a wrong answer. The score of each problem of this test is calculated by itself and its just previous consecutive ‘O’s only when the answer is correct. For example, the score of the 10th problem is 3 that is obtained by itself and its two previous consecutive ‘O’s.

​   Therefore, the score of “OOXXOXXOOO” is 10 which is calculated by “1+2+0+0+1+0+0+1+2+3”.

​   You are to write a program calculating the scores of test results.

Input

​   Your program is to read from standard input. The input consists of T test cases. The number of test cases T is given in the first line of the input. Each test case starts with a line containing a string composed by ‘O’ and ‘X’ and the length of the string is more than 0 and less than 80. There is no spaces between ‘O’ and ‘X’.

Output

​   Your program is to write to standard output. Print exactly one line for each test case. The line is to contain the score of the test case.

Sample Input

5
OOXXOXXOOO
OOXXOOXXOO
OXOXOXOXOXOXOX
OOOOOOOOOO
OOOOXOOOOXOOOOX

Sample Output

10
9
7
55
30

HINT

简单的分数统计,不多解释,看代码就好。

Accepted

#include<stdio.h>
#include<string.h> int main()
{
int sum;
scanf("%d", &sum);
while (sum--)
{
char s[81];
scanf("%s", s);
int len = strlen(s);
int score = 0, t = 0;
for (int i = 0;i < len;i++)
{
if (s[i] == 'O')score += ++t;
else t = 0;
}
printf("%d\n", score);
} }

最新文章

  1. 阮一峰对js的见解(10大缺陷)
  2. (十三)Packet socket 和 sockaddr_ll
  3. 在 Typescript 2.0 中使用 @types 类型定义
  4. 临床试验中PI、CI、SI、COI是指哪些人?
  5. c++模板库(简介)
  6. redis实现与分析
  7. html5新增标签兼容性
  8. CFileDialog的使用方法简单介绍
  9. javax.Swing 使用GridBagLayout的程序栗子
  10. Inno Setup 安装inf文件的一个例子
  11. Java-8ATM
  12. 用户输入与while循环
  13. Kafka水位(high watermark)与leader epoch的讨论
  14. 从头编写 asp.net core 2.0 web api 基础框架 (1)
  15. Injection of autowired dependencies failed
  16. ccd采集
  17. 使用Genymotion遇到的坑_Genymotion无法启动_unable to start the virtual device
  18. 用liferay实现的增删改查例子-book管理系统
  19. SQL群集多实例卸载、安装
  20. 推荐一个lamp的一键安装包

热门文章

  1. Hyperf-事件机制+异常处理
  2. ”capslock+“ 一款超级文本编辑外挂
  3. powerdesigner 16.6破解版下载,支持hive,数据模型hql导出
  4. 推荐模型AutoRec:原理介绍与TensorFlow2.0实现
  5. rest framework Request
  6. 【测试技术分享】在Linux下安装Python3
  7. mysql最经典的语句
  8. SDK音频测试流程
  9. 一次 outline 去除经验(非继承属性,看着像继承)
  10. Docker备份Gitlab容器以及还原数据