Submission #864339

#TimeUsernameProblemLanguageResultExecution timeMemory
864339gutzzyImena (COCI16_imena)C++14
50 / 50
1 ms608 KiB
#include <bits/stdc++.h> using namespace std; bool name(string s){ bool first = true; for(char c:s){ if(isdigit(c)) return false; if(first){ if(c != toupper(c)) return false; } else{ if(c != tolower(c)) return false; } first = false; } return true; } int main(){ int n; cin >> n; //cout << toupper('c') << toupper('C') << tolower('C') << endl; //cout << name("Hola")<<endl; //<< " " << name("a4") << " " << name("4a") << " " << name("ajs") << endl; for(int xx=0;xx<n;xx++){ string s; vector<string> sentence; cin >> s; while(s[s.size()-1]!='.' and s[s.size()-1]!='?' and s[s.size()-1]!='!'){ sentence.push_back(s); cin >> s; } sentence.push_back(s.substr(0,s.size()-1)); int c=0; for(string word:sentence){ if(name(word)) c++; } cout << c << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...