|
|
back to boardWhy WA#2????????? #include<iostream> using namespace std; char c, last, last_zn; int br; int main() { cin.get(last); if(last>='a'&&last<='z') br++; while(cin.get(c)) { if(((last_zn=='.')||(last_zn=='!')||(last_zn=='?'))&&((c>='A')&&(c<='Z'))) last_zn=' '; if(((last_zn=='.')||(last_zn=='!')||(last_zn=='?'))&&((c>='a')&&(c<='z'))) { /*cout<<c<<endl;*/ br++; last_zn=' '; } if(((last>='a'&&last<='z')||(last>='A'&&last<='Z'))&&(c>='A'&&c<='Z')) { /*cout<<c<<endl;*/ br++; } last=c; if((c=='.')||(c=='?')||(c=='!')) last_zn=c; } cout<<br<<endl; return 0; } I tried all the tests here and none of them gave me WA. Can you tell me where is my mistake??? |
|
|