OX퀴즈
2023. 1. 29. 00:17ㆍ개인공부/코딩테스트
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include <iostream>
using namespace std;
int main()
{
int TestCase=0;
string str{};
cin >> TestCase;
int FinalScore = 0;
int PrevScore = 0;
for (int i = 0; i < TestCase; ++i)
{
cin >> str;
for (int j = 0; j < (int)str.size(); ++j)
{
if (str[j] == 79)
{
++PrevScore;
FinalScore += PrevScore;
}
else
{
PrevScore = 0;
}
}
cout << FinalScore << endl;
FinalScore = 0;
PrevScore = 0;
}
}
|
cs |