Cod sursa(job #393342)

Utilizator RoswenRus Alexandru Roswen Data 9 februarie 2010 11:52:20
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 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);
	if(!isalpha(x))
		sw=1;
		
	while(!feof(f))
	{
			
		if(!sw) 
		{
			k++;
			sw=1;
		}
		
		if( isalpha(x) )
		{
			lung++;
			sw=0;
		}
		else sw=1;
		fscanf(f, "%c", &x); 
	}
	if(isalpha(x)) k++;
	printf("%ld", lung/k);
	return 0;
}