| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么WA阿#include <iostream>
using namespace std;
int is(char ch)
{
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
return 1;
return 0;
}
int main()
{
int i, wrong = 0;
char word[10001];
i = 0;
while(cin>>word[i])
{
if(word[i]=='.'||word[i]=='!'||word[i]=='?')
{
word[i+1] = '\0';
i = 0;
while(!is(word[i]))
i++;
if(word[i]<='z'&&word[i]>='a')
wrong++;
for(i = 1; word[i]!='\0'; i++)
{
if(word[i]>='A'&&word[i]<='Z'&&is(word[i-1]))
wrong++;
}
i = -1;
}
i++;
}
cout<<wrong;
return 1;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator