Cod sursa(job #252086)

Utilizator drag0s93Mandu Dragos drag0s93 Data 3 februarie 2009 21:26:59
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
#include<stdio.h>

#include<iostream>

#define N 90000

using namespace std;


char ch[N];


void read()
{
	int i=1;
	freopen("text.in","r",stdin);
	//while(scanf("%c",&ch[i])!=EOF && ++i);
	cin.getline(ch,N,EOF);
}
int solve()
{
	int litere=0,cuvinte=0,i,j;
	for(j=1;ch[j]!='\0';++j)
		if(ch[j]>=65 && ch[j]<=90 || ch[j]>=97 && ch[j]<=122)
			++litere;
	for(i=1;ch[i]!='\0';++i)
		if((ch[i-1]>=65 && ch[i-1]<=90 || ch[i-1]>=97 && ch[i-1]<=122) && (ch[i]<65 || ch[i]>90 && ch[i]<97 || ch[i]>122))
			++cuvinte;
	return litere/cuvinte;
}
void afisare()
{
	freopen("text.out","w",stdout);
	printf("%d",solve());
}
int main()
{
	read();
	solve();
	afisare();
	return 0;
}