我的代码:
#include<bits/stdc++.h>
using namespace std;
string s;
long long cnt=0,n;
bool f=1;
int main(){
cin>>n;
while(cin>>s)
{
f=1;
int k=s.size();
if(s[0]<'A'||s[0]>'Z')f=0;
else{
for(int i=1;i<s.size();i++){
if(s[k-1]=='.'||s[k-1]=='?'||s[k-1]=='!')continue;
if((s[i]<'a'||s[i]>'z'))f=0;
}
}
cnt+=f;
if(s[k-1]=='.'||s[k-1]=='?'||s[k-1]=='!'){
cout<<cnt<<"\n";
cnt=0;
}
}
return 0;
}
hack数据:
输入:
1
BeN.
输出:
0