Cod sursa(job #133800)

Utilizator hadesgamesTache Alexandru hadesgames Data 9 februarie 2008 19:38:22
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <stdio.h>
int main()
{
	FILE *in,*out;
	int d,nr=0,cuv=0;
	char c;
	in=fopen("text.in","r");
	out=fopen("text.out","w");
	d=1;
	while (fscanf(in,"%c",&c)!=EOF)
	{
		if((c<'a'||c>'z')&&(c<'A'||c>'Z'))
			d=1;
		else
		{
			nr++;
			if (d)
			{
				d=0;
				cuv++;
			}
		}
	}
	fprintf(out,"%d\n",nr/cuv);
	fclose(in);
	fclose(out);
	return 0;
}