Cod sursa(job #251868)

Utilizator drag0s93Mandu Dragos drag0s93 Data 3 februarie 2009 15:32:12
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 kb
#include<stdio.h>
#include<iostream>
using namespace std;
#define N 10000000

char ch[N];


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