Cod sursa(job #607171)
| Utilizator | Data | 10 august 2011 23:00:16 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
freopen("text.in", "rb", stdin);
freopen("text.out","w", stdout);
int nr = 0;
int sum = 0;
char ch;
int str_len = 0 ;
while( scanf("%c",&ch) != EOF ) {
if( (ch >= 'a' && ch <= 'z') &&
(ch >= 'A' && ch <= 'Z') )
str_len++;
else {
sum += str_len;
nr++;
str_len = 0;
}
}
printf("%d", sum / nr );
return 0;
}
