Cod sursa(job #37052)

Utilizator swift90Ionut Bogdanescu swift90 Data 24 martie 2007 15:38:12
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include<stdio.h>
int main(){
	FILE*in=fopen("text.in","r");
	FILE*out=fopen("text.out","w");
	int lit=0,cuv=-1;
	char a;
	fscanf(in,"%c",&a);
	while((fscanf(in,"%c",&a))!=EOF){
		if(((a>='a')&&(a<='z'))||((a>='A')&&(a<='Z')))
			lit++;
		else
			cuv++;
		if(a=='!')
			cuv--;
		if(a=='?')
			cuv--;
		if(a=='.')
			cuv--;
		if(a==',')
			cuv--;
		if(lit==0)
			cuv=0;
	}
	
	fprintf(out,"%d\n",lit/cuv);
	return 0;
}