Cod sursa(job #386930)

Utilizator kyrkDragos Dumitrescu kyrk Data 26 ianuarie 2010 12:44:59
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include<stdio.h>
#include<string.h>
int main()
{
    FILE *f=fopen("text.in","r"),*g=fopen("text.out","w");
    char a[1000],*p;
    int i=0,n,cuv=0,lit=0;
    while(!feof(f))
     {  fscanf(f,"%c",&a[i]);i++; }

    p = strtok (a," ,.-:!?';");
    while (p != NULL) {
          cuv++; lit+=strlen(p);
//        fprintf(g,"%d ",strlen(p));
          p = strtok (NULL, " ,.-");
          }
    
//    fprintf(g,"\n%d %d",cuv,lit);
    fprintf(g,"%d",(lit/cuv));
    return 0;
}