ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1038. Spell Checker

Help me please..!!
Posted by Chocobo17 15 Apr 2006 18:43
#include <stdio.h>
#include <string.h>
void main() {
    int i,wrong,beg,len;
    char a[11000];
    scanf("%[ A-Za-z.,;:-!?\n]s",a);
    len=strlen(a);
    wrong=beg=0;
    for(i=0;i<len;i++) {
        if(a[i]=='\n') a[i]=' ';
        if(a[i]=='.'||a[i]==','||a[i]==':'||a[i]==';'||a[i]=='-'||a[i]=='!'||a[i]=='?') beg=0;
        else if(beg==0) {
            if((a[i]>'Z'||a[i]<'A')&&a[i]!=' ') wrong++;
            if(a[i]!=' ') beg=1;
        }
        else if(a[i]<='Z'&&a[i]>='A') {
            if(a[i-1]!=' ') wrong++;
        }
    }
    printf("\n%d",wrong);
}


I don't know why its wrong. I'm wrong in test#3
I'm check many inputs but I think answers is true.
Please suggest me something..TT