Cod sursa(job #1354568)
Utilizator | Data | 21 februarie 2015 21:25:54 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include<fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char a[1024*1024+5],*p;
int nrlitere,nrcuvinte;
bool ok;
int main()
{
while (fin.getline(a,sizeof(a)))
{
for (p=a;*p;++p)
if (('a'<=*p && *p<='z') || ('A'<=*p && *p<='Z'))
ok=true, ++nrlitere;
else if (ok)
ok=false, ++nrcuvinte;
if (ok) ++nrcuvinte, ok=false;
}
fout<<nrlitere/nrcuvinte<<"\n";
return 0;
}