Cod sursa(job #238460)
| Utilizator | Data | 2 ianuarie 2009 11:18:14 | |
|---|---|---|---|
| Problema | Text | Scor | 90 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include<stdio.h>
#include<string.h>
long long int count,wordnumber,i,j,N;
char c,c2='/0';
char cond(char c)
{
if(int(c)>=65&&int(c)<=90||int(c)>=97&&int(c)<=122) return 1;
else return 0;
}
int main()
{
FILE*in=fopen("text.in","r");
FILE*out=fopen("text.out","w");
while(!feof(in))
{
fscanf(in,"%c",&c);
if(cond(c)) count++;
else if(cond(c2)) wordnumber++;
c2=c;
}
fprintf(out,"%lld",count/wordnumber);
fcloseall();
return 0;
}
