Cod sursa(job #522895)
Utilizator | Data | 16 ianuarie 2011 16:01:49 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
using namespace std;
int nr,l;
int main ()
{
char c;
int p=0;
ifstream fin("text.in");
ofstream fout("text.out");
while ((fin.get(c)) && (c!=0))
{
if ((c>='a' && c<='z') || (c>='A' && c<='Z'))
{
p=1;
l++;
}
else if (p)
{
nr++;
p=0;
}
}
if (p)
nr++;
if (nr==0) fout<<'0';
else
fout<<l/nr;
}