Cod sursa(job #238456)
| Utilizator | Data | 2 ianuarie 2009 11:12:49 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include<stdio.h>
#include<string.h>
long long int count,wordnumber,i,j,N;
char c,c2='a ';
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(fscanf(in,"%c",&c)!=EOF)
{
fscanf(in,"%c",&c);
if(cond(c)) count++;
else if(cond(c2)) wordnumber++;
c2=c;
}
fprintf(out,"%lld",count/wordnumber);
fcloseall();
return 0;
}
