Cod sursa(job #31669)
| Utilizator | Data | 16 martie 2007 13:39:48 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <fstream.h>
#include <iomanip.h>
ifstream fi("text.in");
ofstream fo("text.out");
long long n=0;//lungimea totala
long long c=0;//numarul de cuvinte
long off=0;
int main()
{char ch;
while (!fi.eof())
{fi>>resetiosflags(ios::skipws)>>ch;
if ((ch>='a' && ch<='z') || (ch>='A' && ch<'Z'))
{if (off==0) c++;
n++;
off=1;}
else off=0;}
fi.close();
fo<<n/c<<'\n';
fo.close();
return 0;}
