Cod sursa(job #865959)
Utilizator | Dinu Radu RaduGabriel2012 | Data | 27 ianuarie 2013 12:59:43 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char c;
int word=0,i,ch=0,prev=0;
int main()
{
while(!f.eof())
{f.get(c);
if ((c>=65 && c<=90)||((c>=97)&&(c<=122))) {ch++;prev=1;}
else if (prev) {word++;prev=0;}
}
if (prev) word++;
g<<ch/word;
return 0;
}