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 WA #10 THIS IS MY CODE
Posted by HACKER 14 Aug 2011 18:20
#include<iostream>
#include<fstream>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int main()
{
   #ifndef ONLINE_JUDGE
   freopen("input.txt","rt",stdin);
   freopen("output.txt","wt",stdout);
   #endif
   char a[10005]={'\0'};
   int i=0,n=0,g=0,n1,n2;
   bool f=true,ff=false;
   char ab[100]={'\0'};
   int tt=scanf("%s",a);
   while(tt>0)
   {
              strcat(a,ab);
              strcat(a," ");
              tt=scanf("%s",ab);
   }
   n=strlen(a)-1;
   for(i=0;i<n;i++)
   {
        if (32<=int(a[i])&&int(a[i])<=64||91<=int(a[i])&&int(a[i])<=96||123<=int(a[i])&&int(a[i])<=255)
        if (a[i]!='.'&&a[i]!='!'&&a[i]!='?') {continue;}
{continue;}
         if (a[i]=='.'||a[i]=='?'||a[i]=='!') {f=true; continue;}
         if (f&&'a'<=a[i]&&a[i]<='z') {g++; } f=false;

   }
   int k=0; n2=0;
   for(i=0;i<=n;i++)
   {
[i]=='.'||a[i]=='!'||a[i]=='?'||a[i]=='%')
      if (32<=int(a[i])&&int(a[i])<=64||91<=int(a[i])&&int(a[i])<=96||123<=int(a[i])&&int(a[i])<=255)
      {
        n1=n2; n2=i;
        for(int j=n1+1+k; j<n2; j++) if ('A'<=a[j]&&a[j]<='Z') g++;
        k=1;
      }
   }
   cout<<g<<endl;
   return 0;
}