Cod sursa(job #896809)
Utilizator | Bot Cristian Daniel Daniel_Bot | Data | 27 februarie 2013 17:26:15 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
FILE *f=fopen("text.in","r");
freopen("text.out","w",stdout);
char c;
int Nr_Of_Letters=0;
int Nr_Of_Words=0;
int aux=0;
while(fscanf(f,"%c",&c)!=EOF)
{
if( (c >='a' && c<='z') || (c>='A' && c<='Z'))
{
Nr_Of_Letters++;
if( aux==0 )
{
Nr_Of_Words++;
aux=1;
}
}
else
aux=0;
}
printf("%d",Nr_Of_Letters/Nr_Of_Words);
fclose(f);
return 0;
}