# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
630648 | inksamurai | Imena (COCI16_imena) | C++17 | 1 ms | 324 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |