Cod sursa(job #316926)

Utilizator andreioneaAndrei Onea andreionea Data 21 mai 2009 16:46:32
Problema Text Scor 100
Compilator c Status done
Runda Arhiva de probleme Marime 0.41 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,cuv=0;
 char c;
 while(fscanf(f,"%c",&c)==1)
  if(isalpha(c))
   if(!cuv)
           {ncuv++;lcuv++;cuv=1;}
    else lcuv++;
   else cuv=0;
  fprintf(g,"%lld",lcuv/ncuv);
  fclose(f);
  fclose(g);
 return 0;
}