Cod sursa(job #608604)

Utilizator PlayLikeNeverB4George Marcus PlayLikeNeverB4 Data 17 august 2011 14:35:21
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <stdio.h>
#include <string>
using namespace std;

char x;
int L,NR;

int litera(char x) {
	x=toupper(x);
	if(x>='A' && x<='Z') return 1;
	return 0;
}

int main() {
	freopen("text.in","r",stdin);
	freopen("text.out","w"	,stdout);
	
	while(scanf("%c",&x)!=EOF) {
		if(litera(x)) {
			L++;
			while(scanf("%c",&x) && litera(x)) 
				L++;
			NR++;
		}
	}
	if(NR==0) {
		printf(0);
		return 0;
	}
	printf("%d",L/NR);
}