Cod sursa(job #260791)

Utilizator ooctavTuchila Octavian ooctav Data 17 februarie 2009 15:51:15
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
// Text.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <stdlib.h>
char e[2000004];
bool b[2000004];
int main()
{
	int n,i,c=0,d=0;
	FILE *f1,*f2;
	f1=fopen("text.in","r");
	f2=fopen("text.out","w");
	fgets(e,1000003,f1);
	for(i=1;i<=100003;i++)
	{
		if(e[i]<=90)
			if(e[i]>=65)
			{
				c++;
				b[i]=true;
			}
		if(e[i]>=97)
			if(e[i]<=122)
			{
				c++;
				b[i]=true;
			}
		if(e[i]>122 || e[i]<65)
				if(b[i-1]==true)
					d++;
		if(e[i]>90 && e[i]<97)
			if(b[i-1]==true)
				d++;
	}
	fprintf(f2,"%d",c/d);
	fclose(f1);
	fclose(f2);

	return 0;
}