Submission #999284

#TimeUsernameProblemLanguageResultExecution timeMemory
999284AliHasanliImena (COCI16_imena)C++17
50 / 50
0 ms392 KiB
#include <bits/stdc++.h> using namespace std; bool punc(char c) { return (c=='.' || c=='?' || c=='!'); } int main() { int n; cin>>n; string s; int ans=0; while(n && cin>>s) { bool name=isupper(s[0]); for(int i=1;name && i<s.size() && !punc(s[i]);i++) name&='a'<=s[i]&&s[i]<='z'; ans+=name; if(punc(s.back())) { cout<<ans<<endl; ans=0,n--; } } return 0; }

Compilation message (stderr)

imena.cpp: In function 'int main()':
imena.cpp:16:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |   for(int i=1;name && i<s.size() && !punc(s[i]);i++)
      |                       ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...