#include <bits/stdc++.h>
using namespace std;
const long long mx=2*1e5+5;
const long long mod=1e9+7;
typedef long long ll;
#define f first
#define s second
bool uper(char x){
return(x>='A'&&x<='Z');
}
bool lower(char x){
if(x=='.'||x=='?'||x=='!'){return 1;}
return(x>='a'&&x<='z');
}
bool endd(char x){
return (x=='.'||x=='?'||x=='!');
}
int main() {
int n;cin>>n;
int counter=0;
string s;
ll temp=0;
while(counter<n){
cin>>s;
int ss=s.size();
int b=0;
if(uper(s[0])){
for(int j=1;j<ss;j++){
if(!lower(s[j])){b=1;break;}
}if(b==0){temp++;}
}
if(endd(s[ss-1])){
cout<<temp<<endl;
temp=0;
counter++;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
416 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
1 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |