Cod sursa(job #43140)
| Utilizator | Data | 29 martie 2007 20:53:19 | |
|---|---|---|---|
| Problema | Text | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <stdio.h>
#include <string.h>
int main()
{
char s[50000];
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;
}
