Cod sursa(job #493724)

Utilizator NaSaCiocionica Ionut NaSa Data 19 octombrie 2010 09:42:17
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include<ctype.h>
ifstream f("text.in");
ofstream g("text.out");
int main()
{
	char s[256];
	long long i,j=0,k=0;
	while(f.get(s,255))
	{for(i=0;i<=strlen(s)-1;i++)
		if(isalpha(s[i])){j++;
						 if(!isalpha(s[i-1])) k++;}
		if(isalpha(s[0])) k++;}
						 
	g<<j/k;
		cout<<j<<endl<<k;
		
		g.close();
		f.close();
}