Pagini recente » Cod sursa (job #1703078) | Cod sursa (job #2537388) | Cod sursa (job #1447956) | Cod sursa (job #2886266) | Cod sursa (job #724073)
Cod sursa(job #724073)
#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;
}