Cod sursa(job #627735)

Utilizator alexalghisiAlghisi Alessandro Paolo alexalghisi Data 30 octombrie 2011 16:24:12
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.68 kb
#include <cstdio>
#define DN 1024*1025
using namespace std;


char x[DN];

int main()
{
	int nrcuv=0,nrlitere=0;
	freopen("text.in","r", stdin);
	freopen("text.out","w", stdout);
	fgets(x,1000005,stdin);
	
	int j=1;
	//for(int i=0;x[i]!=0;i++)
	while(1)
	{
		if(x[j]==' ' || x[j]==',' || x[j]=='-') j++;
		
		while((x[j]>='a' && x[j]<='z') || (x[j]>='A' && x[j]<='Z')) 
		{
			nrlitere++;
			j++;
		}
		
		if(x[j]=='-') j++;
		while((x[j]>='a' && x[j]<='z') || (x[j]>='A' && x[j]<='Z'))
		{
			nrlitere++;
			j++;
		}
		
		nrcuv++;
		
		if(x[j]=='!' || x[j]=='?' || x[j]=='.') break;
	}
	
	printf("%d %d %d",nrlitere,nrcuv,nrlitere/nrcuv);
	
	return 0;
}