Cod sursa(job #1417652)
| Utilizator | Data | 10 aprilie 2015 19:04:30 | |
|---|---|---|---|
| Problema | Text | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
#define N 4096
char a[N],*p;
int litere()
{while(!((*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z')))p++;
return strlen(p);
}
int main()
{char sep[]="!@#$%^&*()_+1234567890-=`~{}:|<>?[];,./ ";
long long s=0,nr=0;
FILE *f=freopen("text.in","r",stdin),*g=freopen("text.out","w",stdout);
while(fgets(a,N,f)!=NULL)
{p=strtok(a,sep);
while(p)
{s+=litere();++nr;p=strtok(NULL,sep);
}
}
fprintf(g,"%d",(int)s/nr);
}
