Cod sursa(job #392604)

Utilizator cosmyoPaunel Cosmin cosmyo Data 7 februarie 2010 20:32:39
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include<fstream.h>
using namespace std;
char c;
long nrc,lg,lc;
void cit()
{ifstream fin("text.in");
  while(!fin.eof())
   {fin.get(c);
    if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
	 lc++;
	else
	if(lc!=0)
	 {nrc++;
	  lg+=lc;
	  lc=0;
	 }
   }
 if(lc!=0)
 {nrc++;
  lg+=(lc-1);
 }
 fin.close();
}
void afis()
{ofstream fout("text.out");
 long x=lg/nrc;
  fout<<x;
 fout.close();
}
int main()
{cit();
 afis();
 return 0;
}