Cod sursa(job #1148918)
Utilizator | Data | 21 martie 2014 12:05:41 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <cstdio>
using namespace std;
long s,cuv,r,z;
char c;
FILE *f,*g;
int main()
{
f=fopen("text.in","r");
g=fopen("text.out","w");
z=fscanf(f,"%c",&c);
while (z-1==0)
{
if (((c>='a')&&(c<='z'))||((c>='A')&&(c<='Z')))
{
if (cuv==0) r++;
cuv=1; s++;
}
else
cuv=0;
z=fscanf(f,"%c",&c);
}
if (r!=0)
fprintf(g,"%ld",s/r);
else
fprintf(g,"0");
fclose(f); fclose(g);
return 0;
}