Cod sursa(job #349029)

Utilizator shnakoVlad Schnakovszki shnako Data 17 septembrie 2009 19:59:29
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.36 kb
#include <stdio.h>
#include <ctype.h>
FILE *f=fopen("text.in", "r"), *g=fopen("text.out", "w");
char x;
int sw, s, cuv;
int main(void)
{
	while (!feof(f))
	{
		fscanf(f, "%c", &x);
		if (isalpha(x))
			if (sw==0)
				{
				sw=1;
				s++;
				cuv++;
				}
			else
				s++;
		if (sw&&!isalpha(x))
			sw=0;
	}
	fprintf(g, "%d", s/cuv);
	return 0;
}