Cod sursa(job #480479)
| Utilizator | Data | 28 august 2010 01:51:10 | |
|---|---|---|---|
| Problema | Text | Scor | 90 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
//#include <iostream>
//using namespace::std;
//using namespace std;
int main()
{
char c;
int word=0, total_words=0, sum=0;
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
c=getchar();
while(c!=EOF)
{
//printf("%c",c);
if(isalpha(c)) word++;
else if(word>0) { sum+=word; total_words++; word=0; }
c=getchar();
}
printf("%d",sum/total_words);
return 0;
}