Cod sursa(job #893043)
| Utilizator | Data | 26 februarie 2013 12:45:54 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <cstdio>
#include <string.h>
int x,nr;
char *p,s[1000],sep[]={"- ,.!;"};
int main ()
{
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
gets(s);
p=strtok(s,sep);
if(strlen(p)) x++,nr+=strlen(p);
while (p)
{
p=strtok(NULL,sep);
if(p==NULL) break;
if(strlen(p)) x++,nr+=strlen(p);
}
printf("%ld",nr/x);
return 0;
}
