Cod sursa(job #34230)

Utilizator bilygates2005Liviu Cristian Mirea-Ghiban bilygates2005 Data 20 martie 2007 13:52:31
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include<stdio.h>
int main()
{
 long count=0,sum=0,current=0;
 char c,sw=0;
 freopen("text.in","r",stdin);
 while(!feof(stdin))
 {
  scanf("%c",&c);
  if((c>='a' && c<='z') || (c>='A' && c<='Z'))
  {current++;sw=1;}
  else
  {
   if(sw==1){sw=0;count++;sum+=current;current=0;}
  }
 }
 fclose(stdin);
 freopen("text.out","w",stdout);
 printf("%ld",sum/count);
 fclose(stdout);

 return 0;
}