Cod sursa(job #879970)

Utilizator nutipasa16Macovei Claudiu nutipasa16 Data 16 februarie 2013 01:20:55
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include<fstream>
#include<string.h>
#define dim 1000000
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char text[dim];
int n,nr,l;
int main()
{
	f.get(text,dim);
    int i=0; 
	n=strlen(text);
	if((text[0]>'A' && text[0]<'Z') || (text[0]>'a' && text[0]<'z'))
	{
		nr++;
		l=1;
	}
	i++;
    while(i<=n)
	{
		if((text[i]<'A' || text[i]>'Z') && (text[i]<'a' || text[i]>'z'))
		{
			if((text[i+1]>='A' && text[i+1]<='Z') || (text[i+1]>='a' && text[i+1]<='z'))
				nr++;
		}
		else
			l++;
		i++;
	}
	g<<l/nr<<"\n";
    return 0;
}