Cod sursa(job #522874)
| Utilizator | Data | 16 ianuarie 2011 15:22:12 | |
|---|---|---|---|
| Problema | Text | Scor | 90 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<stdio.h>
char a,b;
int x=0,y=0;;
FILE *in,*out;
int main()
{
in=fopen("text.in","r");
a=getc(in);
while((b=getc(in))!=EOF)
{
if(((a>='a'&&a<='z')||(a>='A'&&a<='Z'))&&!((b>='a'&&b<='z')||(b>='A'&&b<='Z'))) x++;
if((a>='a'&&a<='z')||(a>='A'&&a<='Z')) y++;
a=b;
}
fclose(in);
out=fopen("text.out","w");
if(x==0) x++;
fprintf(out,"%ld",y/x);
fclose(out);
} 