Cod sursa(job #1247699)
Utilizator | Data | 23 octombrie 2014 13:19:24 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.56 kb |
#include<stdio.h>
int main()
{
FILE *f = fopen("text.in", "r");
FILE *g = fopen("text.out", "w");
char ch;
int ok = 0;
int count = 0;
int sum = 0;
while(!feof(f))
{
fscanf(f, "%c", &ch);
if((ch>='a' && ch <='z') || (ch>='A' && ch <='Z'))
{
sum++;
if(!ok)
{
ok = 1;
count++;
}
}
else if (ok)
ok = 0;
}
fprintf(g, "%d", sum/count);
return 0;
}