Cod sursa(job #43142)
Utilizator | Jurba Andrei znakeu | Data | 29 martie 2007 20:53:55 |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <stdio.h>
#include <string.h>
int main()
{
char s[100000];
char *wtf;
int n=0,c=0;
FILE *in=fopen("text.in","r"),*out=fopen("text.out","w");
fgets(s,999999,in);
wtf = strtok (s," ,.-!?");
while (wtf != NULL)
{
n+=strlen(wtf);
c++;
wtf = strtok (NULL, " ,.-!?");
}
n--; //removing \n
c--; //removing \n
fprintf(out,"%d\n",n/c);
fclose(in);
fclose(out);
return 0;
}