Cod sursa(job #724073)
| Utilizator | Data | 26 martie 2012 10:45:25 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include<stdio.h>
using namespace std;
int main() {
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
char x,y='a';
int countwords=0,length=0;
if(scanf("%c",&x)==EOF) printf("0");
else {
if((x>='a' && x<='z') || (x>='A' && x<='Z')) {
length++;
countwords++;
}
while(scanf("%c",&y)!=EOF) {
if((y>='a' && y<='z') || (y>='A' && y<='Z')) {
length++;
if(!((x>='a' && x<='z') || (x>='A' && x<='Z')))
countwords++;
}
x=y;
}
printf("%d",length/countwords);
}
return 0;
}
