Submission #221977

#TimeUsernameProblemLanguageResultExecution timeMemory
221977Haunted_CppImena (COCI16_imena)C++17
50 / 50
5 ms384 KiB
/* 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...