Cod sursa(job #583770)

Utilizator rendorzegAndrei Pavel rendorzeg Data 22 aprilie 2011 16:40:49
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <stdio.h>
#include <ctype.h>
int main()
{
	freopen ("text.in","r",stdin);
    freopen ("text.out","w",stdout);
	long long tot = 0;
	long long nr = 0;
    char c;
	int s=0;
    while(scanf("%c",&c) != EOF)
	{
		if(isalpha(c))
			++tot;
		switch(s)
		{
			case 0:
				if(isalpha(c))
				{
					s=1;
					nr++;					  
				}
				break;
			case 1:
				if(!isalpha(c))
					s=0;
				break;
		}
	}
	printf("%d",(tot/nr));
	return 0;
}