Submission #630648

#TimeUsernameProblemLanguageResultExecution timeMemory
630648inksamuraiImena (COCI16_imena)C++17
50 / 50
1 ms324 KiB
#include <bits/stdc++.h> using namespace std; #define sz(a) (int)a.size() #define _3phCa4T ios::sync_with_stdio(0),cin.tie(0) void print(){cout<<'\n';} template<class h,class...t> void print(const h&v,const t&...u){cout<<v<<' ',print(u...);} // e signed main(){ _3phCa4T; int n; cin>>n; string s; getline(cin,s); getline(cin,s); string word=""; int now=0; auto af=[&](string word)->bool{ if(sz(word)){ bool h=0; if('A'<=word[0] and word[0]<='Z'){ h=1; } bool t=1; for(int j=1;j<sz(word);j++){ if(!('a'<=word[j] and word[j]<='z')){ t=0; } } return h*t; } return 0; }; for(int i=0;i<sz(s);i++){ if(s[i]==' '){ now+=af(word); word=""; }else if(s[i]=='.' or s[i]==',' or s[i]=='?' or s[i]=='!'){ now+=af(word); word=""; print(now); now=0; }else{ word+=s[i]; } } }

Compilation message (stderr)

imena.cpp: In lambda function:
imena.cpp:31:12: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
   31 |    return h*t;
      |           ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...