Cod sursa(job #1222971)
Utilizator | Data | 24 august 2014 21:29:45 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <fstream>
using namespace std;
ifstream cin("text.in");
ofstream cout("text.out");
int i,n,nrwords(0),word(0),letters(0);
int main()
{
char aux;
while(cin.get(aux))
{
if ((aux>='a' && aux<='z')||(aux>='A' && aux<='Z'))
{
word=1;
++letters;
}
else
if (word) ++nrwords,word=0;
}
if (word) ++nrwords;
cout<<letters/nrwords<<"\n";
return 0;
}