Cod sursa(job #1051881)
| Utilizator | Data | 10 decembrie 2013 17:37:05 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <string.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
FILE *in=fopen("text.in","r"),*out=fopen("text.out","w");
long cr=0,cuv=0;
bool inword=false;
void _read()
{
char ch;
while(!feof(in))
{
fscanf(in,"%c",&ch);
if( (ch>='a' && ch<='z') || (ch>='A' && ch<='Z') )
{
if(!inword )
{
cuv++;
inword=true;
}
cr++;
}
else
inword=false;
}
}
int main()
{
_read();
fprintf(out,"%ld",cr/cuv);
return 0;
}
