Cod sursa(job #547914)

Utilizator balakraz94abcd efgh balakraz94 Data 6 martie 2011 20:17:05
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include<cstdio>
#define infile "text.in"
#define outfile "text.out"
#define L 1000005 
using namespace std;

void citeste();
void afiseaza();

char s[L];
int n;
int nr=0;
int len=0;

void citeste()
{
	freopen(infile,"r",stdin);
	
	char c;
	int ok=0;
	
	scanf("%c",&c);
	while(c!='\n')
	{
		if((c>='a' && c<='z') || (c>='A' && c<='Z')) len++,ok=1;
		else if(ok) nr++, ok=0; 
		scanf("%c",&c);
	}
	if(ok) nr++;
	
	n=len/nr;
	
	fclose(stdin);
}



void afiseaza()
{
	freopen(outfile,"w",stdout);
	
	printf("%d",n);
	
	fclose(stdout);
}


int main()
{
	citeste();
	afiseaza();
	
	return 0;
}