Cod sursa(job #770537)
| Utilizator | Data | 23 iulie 2012 13:10:10 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <stdio.h>
#include <string.h>
#include <ctype.h>
FILE *f=fopen("text.in","r");
FILE *g=fopen("text.out","w");
char s[1000000],sep[256],*p;
int np,cuv,total,med,k,i;
int main(){
k=0;
for(i=1;i<=255;i++){
char x=i;
if(!islower(x)&&!isupper(x)) sep[k++]=x;
}
sep[k]='\0';
fgets(s,1000000,f);
cuv=0;
total=0;
p=strtok(s,sep);
while(p){
np=strlen(p);
total+=np;
cuv++;
p=strtok(NULL,sep);
}
med=total/cuv;
fprintf(g,"%d",med);
fclose(g);
return 0;
}
