# 给出一个由O和X组成的串，长度为1~80，统计得分

给出一个由O和X组成的串，长度为1~80，统计得分，每个O的得分为目前连续出现的O的个数，X的得分为0，例如OOXXO的得分为1+2+0+0+1.

以下程序实现了这一功能，请你补全空白处内容：

```cpp
#include "stdlib.h"
#include "string.h"
#include "stdio.h"
int main()
{
    char s[85];
    int score = 0, x;
    scanf("%s", &s);
    for (int i = 0; s[i]; i++)
    {
        if (s[i] == 'X')
            score += 0;
        if (s[i] == 'O')
        {
            int temp = 1;
            if (i == 0)
                score += 1;
            else
            {
                x = i;
                while (x > 0)
                {
                    ________________;
                }
                score += temp;
            }
        }
    }
    printf("%d\n", score);
    return 0;
}
```

## template

```cpp
#include "stdlib.h"
#include "string.h"
#include "stdio.h"
int main()
{
    char s[85];
    int score = 0, x;
    scanf("%s", &s);
    for (int i = 0; s[i]; i++)
    {
        if (s[i] == 'X')
            score += 0;
        if (s[i] == 'O')
        {
            int temp = 1;
            if (i == 0)
                score += 1;
            else
            {
                x = i;
                while (x > 0)
                {
                    if (s[x - 1] == 'O')
                        temp++;
                    else
                        break;
                    x--;
                }
                score += temp;
            }
        }
    }
    printf("%d\n", score);
    return 0;
}
```

## 答案

```cpp
if (s[x - 1] == 'O')
	temp++;
else
	break;
x--;
```

## 选项

### A

```cpp
if (s[x - 1] == 'O')
	temp++;
else
	break;
```

### B

```cpp
if (s[x - 1] == 'O')
	temp++;
```

### C

```cpp
if (s[x - 1] == 'O')
	temp++;
x--;
```