Cod sursa(job #316925)

Utilizator andreioneaAndrei Onea andreionea Data 21 mai 2009 16:41:42
Problema Text Scor 40
Compilator c Status done
Runda Arhiva de probleme Marime 0.46 kb
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define NMax 1024*1024
char text[NMax];
int main()
{FILE *f=fopen("text.in","r"),*g=fopen("text.out","w");
long long i=-1,l,lcuv=0,ncuv=0;
 fgets(text,NMax,f);
 l=strlen(text);
 while(i<l)
  {i++;
    if(isalpha(text[i]))
       {ncuv++;
        while(isalpha(text[i]) && i<l )
            ++i,++lcuv; 
        }
   }
  fprintf(g,"%lld",lcuv/ncuv);
  fclose(f);
  fclose(g);
 return 0;
}