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 have WA 3 ??????
Posted by Куделевский Женя [SESC USU] 28 May 2005 17:57
int Capital(char c)
{
    if(c>='A' && c<='Z') return(1);
    else return(0);
}

int Small(char c)
{
    if(c>='a' && c<='z') return(1);
    else return(0);
}

int Punctual(char c)
{
    if(!Small(c) && !Capital(c)) return(1);
    else return(0);
}

int main()
{
    char a[10001],c;
    int tl=0,i;

    freopen("input.txt","r",stdin);
    while(scanf("%c",&c)>0)
    {
        if(c!='\n') a[tl++]=c;
    }

    int begsent=1,res=0;
    for(i=0;i<tl;i++)
    {
        if(begsent && Small(a[i])) res++;
        if(i>0 && !Punctual(a[i-1]) && Capital(a[i])) res++;
        if(begsent && !Punctual(a[i])) begsent=0;
        else if(!begsent && a[i]=='?' || a[i]=='.' || a[i]=='!') begsent=1;
    }

    printf("%d\n",res);

    return 0;
}
Re: Why I have WA 3 ??????
Posted by Samun_Victor [SESC USU] 4 Jun 2005 14:36
Try to read a line symbol-by-symbol, instead of entirely at once.
When you will read a symbol, determine the status (the new paragraph (offer),
whether there was a capital letter and so on). Then you will count amount of
mistakes. I have written the Pascal language program and have received "Accepted"
(0.015seconds with allocation of memory 133kBytes)

Edited by author 04.06.2005 14:37
No subject
Posted by Samun_Victor [SESC USU] 4 Jun 2005 14:37
Good Luck!