Cod sursa(job #75341)
Utilizator | Ionescu Victor Cristian vanila_CPP | Data | 1 august 2007 13:37:13 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.94 kb |
#include <stdio.h>
enum stare {OUT, IN};
void iofile(void)
{
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
}
void prel(void)
{
long lung,nrc;
stare x=OUT;
int c;
lung=nrc=0;
while ((c=getchar())!=EOF)
{
if (((c>='a')&&(c<='z'))||((c>='A')&&(c<='Z')))
{
lung++;
if (x==OUT)
{
nrc++;
x=IN;
}
} else
{
x=OUT;
}
}
printf("%ld\n",lung/nrc);
fclose(stdin);
fclose(stdout);
}
int main(void)
{
iofile();
prel();
}