Submission #864343

#TimeUsernameProblemLanguageResultExecution timeMemory
864343ElenaBMImena (COCI16_imena)C++17
50 / 50
0 ms348 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...