Pagini recente » Cod sursa (job #1181164) | Cod sursa (job #1893631) | Cod sursa (job #1797935) | Cod sursa (job #2025656) | Cod sursa (job #724048)
Cod sursa(job #724048)
#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;
scanf("%c",&x);
if((x>='a' && x<='z') || (x>='A' && x<='Z')) length++;
while(scanf("%c",&y)==1) {
//scanf("%c",&y);
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;
}