Cod sursa(job #490796)
| Utilizator | Data | 7 octombrie 2010 22:36:28 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.71 kb |
// infoarena: problema/text //
#include <fstream>
#include <cstring>
using namespace std;
ifstream in("text.in");
ofstream out("text.out");
int num,sum,in_word,s;
char c;
int main()
{
in_word = false;
while(in.good())
{
c = in.get();
if((c>='a' && c<='z') || (c>='A' && c<='Z'))
{
if(in_word)
++ s;
else
{
in_word = true;
s = 1;
}
}
else
{
if(s)
{
++ num;
sum += s;
}
s = 0;
in_word = false;
}
}
//out<<sum<<' '<<num<<'\n';
out<<sum/num;
return 0;
}
