Cod sursa(job #198644)
Utilizator | Data | 13 iulie 2008 14:32:54 | |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.58 kb |
#include <stdio.h>
#include <string>
#define MAXN 1<<20+1
char s[MAXN];
long i,nr,h;
int main()
{
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
fgets(s,sizeof(s),stdin);
i=0;
while (i<strlen(s))
{
while ( !( ( (s[i] >= 'a') && (s[i] <= 'z') ) || ( (s[i] >= 'A') && (s[i] <= 'Z') ) ) ) ++i;
while ( (i<strlen(s)) && ( ( (s[i] >= 'a') && (s[i] <= 'z') ) || ( (s[i] >= 'A') && (s[i] <= 'Z') ) )) ++i,++h;
if (i<strlen(s)) ++nr;
}
printf("%ld\n",h/nr);
return 0;
}