Cod sursa(job #393354)

Utilizator RoswenRus Alexandru Roswen Data 9 februarie 2010 12:00:14
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include<stdio.h>
#include<string.h>
#include<ctype.h>

FILE *f=fopen("text.in","r");
char x;
long lung,k=0,i,sw;
int main()
{
	//freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	
	/*for(i=32;i<=126;i++)
		if( (i<65 || i>90)&&(i<97 || i>122) )
		{
			sep[k]=i;
			k++;
		}
	sep[k]='\0';
	*/
	fscanf(f, "%c", &x);
		
	while(!feof(f))
	{
			
		if( isalpha(x) )
		{
			lung++;
			if(!sw)
			{
				k++;
				sw=1;
			}
		}
		else sw=0;
		
		fscanf(f, "%c", &x); 
	}
	
	printf("%ld", lung/k);
	return 0;
}