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

Why I got WA
Posted by VS. Mode 27 Dec 2002 16:40
Please check my Program//Spell checker is
created by MR.T Dtone Vorapong
Suppakitpaisarn
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
int main(void)
    {
    int
statesmall=0,statecapital=1,count=0;
    char x;
    FILE *fp,*fp2;
    fp=stdin;
    fp2=stdout;
    while(!feof(fp))
        {
        fscanf(fp,"%c",&x);
        if((x>='A')&&(x<='Z')&&
(statecapital==0))

    {count++;statesmall=1;}
        else if(x=='\n')
statecapital=1;
        else if((x>='a')&&(x<='z')
&&(statesmall==0))

    {count++;statesmall=1;statecapital=0;
}
        else if((x==',')||(x==';')||
(x==':')||(x=='-')||(x==' '))
            statecapital=1;
        else if((x=='.')||(x=='!')||
(x=='?'))
            {
            statecapital=1;
            statesmall=0;
            }
        else if((x>='A')&&
(x<='Z'))
            {
            statecapital=0;
            statesmall=1;
            }
        else if((x>='a')&&
(x<='z'))
            {
            statecapital=0;
            statesmall=1;
            }
        }
    fprintf(fp2,"%d",count);
    return 0;
    }