/*
author: Haunted_Cpp
*/
#include <iostream>
#include <algorithm>
#include <vector>
#pragma GCC optimize ("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
int main () {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
string w;
cin >> n >> ws;
getline (cin, w);
vector<string> frases;
string cur;
string fim = ".?!";
for (char c : w) {
if (fim.find(c) != string::npos) {
frases.emplace_back(cur);
cur.clear();
} else {
cur += c;
}
}
for (string to : frases) {
int res = 0;
for (int i = 0; i < (int) to.size(); ) {
string palavra;
while (i < (int) to.size() && to[i] != ' ') {
palavra += to[i];
++i;
}
++i;
if (palavra.empty()) continue;
if (!isupper(palavra[0])) continue;
for (int j = 1; j < (int) palavra.size(); j++) {
if (isupper(palavra[j]) || isdigit(palavra[j])) goto fim;
}
++res;
fim:;
}
cout << res << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |