Cod sursa(job #29831)

Utilizator robertzelXXX XXX robertzel Data 10 martie 2007 16:54:10
Problema Text Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
//text
#include <stdio.h>
#include <string.h>
int main ()
{char s[100];
long sum=0, n=0, c, k;
FILE *fi, *fo;
fi=fopen("text.in","r");
fo=fopen("text.out","w");
while (!feof(fi))
      {
      fscanf(fi,"%s",s);
      c=strlen(s)-1;
      if ((s[c]>64&&s[c]<91)||(s[c]>96&&s[c]<123)||c)
	 {
	 k=1;
	 if((s[c]>64&&s[c]<91)||(s[c]>96&&s[c]<123))k=0;
	 if(strchr(s,'-')) k++;
	 sum+=strlen(s)-k;
	 n++;
	 }
      }
fprintf(fo,"%ld",sum/n);
fclose(fi);
fclose(fo);
return 0;
}