|
|
back to boardCan any one check my code pls. Why I ma gettting wrong answer? #include<stdio.h> void main(void) { int ch,c,start_s,start_w; c=0; start_s=1,start_w=0; while((ch=getchar())!=-1) { if(ch=='\n')continue; if(ch=='.' || ch=='?' || ch=='!') {start_s=1;continue;} if(ch==' '){start_w=1;continue;} if(start_s && ch>='a' && ch<='z') {start_s=start_w=0;c++;continue;} else { if(!start_s && start_w && ch>='A' && ch<='Z') c++; start_w=0; start_s=0; } } printf("%d\n",c); } |
|
|