Cod sursa(job #97986)
| Utilizator | Data | 9 noiembrie 2007 17:55:28 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<string.h>
#include<stdio.h>
int main()
{
char s[1000000],sr[]=" 1234567890-=`~!@#$%^&*()_+;:[]{}'<>,.?/|\",*p;
long n=0,k=0,x;
long i=1;
s[0]='1';
FILE *fin,*fout;
fin=fopen("text.in","r");
for (i=1;s[i-1]!=NULL;i++)
fscanf(fin,"%c",&s[i]);
p=strtok(s,sr);
while(p!=NULL){n++;k+=strlen(p);p=strtok(NULL,sr);}
x=k/n;
fout=fopen("text.out","w");
fprintf(fout,"%ld",x);
fclose(fin);
fclose(fout);
return 0;
}