Cod sursa(job #88540)

Utilizator gabitzish1Gabriel Bitis gabitzish1 Data 2 octombrie 2007 21:57:45
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include<stdio.h>
int cuv(char c){
	if ((c>='a')&&(c<='z'))
		return 1;
	if ((c>='A')&&(c<='Z'))
		return 1;
	return 0;
}
int main(){
	int i=0,cuvinte=0,s=0;
	char a;
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	while (!feof(stdin)){
		scanf("%c",&a);
		if ((cuv(a)==1)&&(i==0)){
			cuvinte+=1;
			s+=1;
			i=2;
		}
		else if (cuv(a)==1)
			s+=1;
		else if (cuv(a)==0)
			i=0;
	}
	printf("%d\n",s/cuvinte);
	return 0;
}