Cod sursa(job #11533)

Utilizator skyelHighScore skyel Data 31 ianuarie 2007 20:28:02
Problema Text Scor 80
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb

#include<fstream.h>
#include<string.h>
#define input "text.in"
#define output "text.out"


int main()
	{
	ifstream fin(input);
	char a[100000];
	char *b;
	int s,n,i,ant=0;
	b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	s=0;
	while( !fin.eof() )
		{
		fin.getline(a,100000);
		for(i=0;i<strlen(a);i++)
			{
			if(strchr(b,a[i]))
				{
				n++;
				ant=1;
				}
			else
				if(ant)
					{
					s++;
               ant=0;
					}
			}
		}
	ofstream fout(output);
	fout<<n/s;
	return 0;
	}