# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
630648 | inksamurai | Imena (COCI16_imena) | C++17 | 1 ms | 324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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];
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |