Cod sursa(job #88517)

Utilizator toni2007Pripoae Teodor Anton toni2007 Data 2 octombrie 2007 19:55:27
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include<stdio.h>
int cuv(char c){
	if ((c-'a'>0)&&(c-'z'<0))
		return 1;
	if ((c-'A'>0)&&(c-'Z'<0))
		return 1;
	return 0;
}
/*int citire(char c){
	if ((c>20)&&(c<120))
		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 (a){
		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);
	fclose(stdin);
	fclose(stdout);
	return 0;
}