Cod sursa(job #806234)

Utilizator razvan9310FMI - Razvan Damachi razvan9310 Data 2 noiembrie 2012 02:26:23
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.62 kb
#include <fstream>
#include <string.h>
using namespace std;

char text[20000000];

int main()
{
	ifstream in("text.in"); ofstream out("text.out");
	int l = 0, cuv = 0, i;
	in.get(text, 2000000);
	for (i=1;i<strlen(text);i++)
		if ((text[i] >= 'A' && text[i] <= 'Z') || (text[i] >= 'a' && text[i] <= 'z'))
		{
			l++;
			if ((text[i-1] < 'A' || text[i-1] > 'Z') && (text[i-1] < 'a' || text[i-1] > 'z'))
				cuv++;
		}
	if ((text[0] >= 'A' && text[0] <= 'Z') || (text[0] >= 'a' && text[0] <= 'z'))
	{
		l++;
		if ((text[1] < 'A' || text[1] > 'Z') && (text[1] < 'a' || text[1] > 'z'))
				cuv++;
	}
	out<<l/cuv;
}