Cod sursa(job #493730)
| Utilizator | Data | 19 octombrie 2010 10:01:19 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int num,sum,ok,s;
char c;
int main()
{
ok = false;
while(f.good())
{
c = f.get();
if((c>='a' && c<='z') || (c>='A' && c<='Z'))
{
if(ok)
s++;
else
{
ok = true;
s = 1;
}
}
else
{
if(s!=0)
{
num++;
sum += s;
}
s = 0;
ok = false;
}
}
g<<sum/num;
return 0;
}
