Cod sursa(job #1452657)

Utilizator miulescu94Miulescu Stefan-Adrian miulescu94 Data 21 iunie 2015 16:24:23
Problema Text Scor 100
Compilator c Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <stdio.h>
#include <string.h>
char txt;
int main()
{
	int length = 0, cuv = 0, med = 0, semn = 1;
	freopen("text.in", "r",stdin);
	freopen("text.out", "w", stdout);
		while ((txt=getchar()) != EOF)
		{
			if (semn == 1)
			if (((txt >= 'a') && (txt <= 'z')) || ((txt >= 'A') && (txt <= 'Z')))
			{ 
				cuv++; 
				semn = 0; 
			}
			if (((txt >= 'a') && (txt <= 'z')) || ((txt >= 'A') && (txt <= 'Z')))
				length++;
			else
				semn = 1;	
		}
	med =length/cuv;
	printf("%d\n",med);
	return 0;
}