#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>> n;
int frase = 0;
while (frase < n){
string s;
getline (cin, s);
s.push_back(' ');
int cont = 0;
bool name = false;
if (s[0] > 64 && s[0] < 91){
name = true;
cont += 1;
}
for (int i = 1; i < (int)s.size()-1; i++){
if (s[i] < 91){
if (s[i] > 64 && !name){ //mayusculas y principio nombre
name = true;
cont += 1;
}
else if (s[i] < 65){ //signos puntuacion o numeros
if (name == true && s[i] > 47 && s[i] < 58){ //no es nombre
cont--;
name = false;
}
else if (s[i] == 33 or s[i] == 46 or s[i] == 63){
frase++;
cout<< cont << '\n';
name = false;
cont = 0;
}
else{
name = false;
}
}
}
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |