Cod sursa(job #643545)
| Utilizator | Data | 3 decembrie 2011 20:57:17 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void)
{
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
int inword=0;
double nr_cuv=0;
double nr_litere=0;
char ch;
while((ch=getchar())!=EOF)
{
if((ch>='A' && ch<='Z') || (ch>='a' && ch<='z'))
{
inword=1;
++nr_litere;
}
else
{
if(inword==1)
{
++nr_cuv;
inword=0;
}
}
}
if(nr_cuv)
{
printf("%d",(int)(nr_litere/nr_cuv));
}
else
{
printf("0");
}
return 0;
}
