Cod sursa(job #536307)

Utilizator legendarulDavid Anton Erculescu legendarul Data 18 februarie 2011 15:45:25
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<fstream>
#include<string>
#include<ctype.h>
using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

int main()
{ char text[1100001];
	int n,i,k,cuv;
	k=0;
	cuv=0;
	fin.get(text,1100000);
	fin.get();
	n=strlen(text);
	
	for(i=0;i<=n;i++)
	{ if(isalpha(text[i]))
		{ k++;
		}
		else if(text[i]==' ' || text[i]=='-')
		{ cuv++;
		}
	}
	
	fout<<k/cuv;
	return 0;
}