Cod sursa(job #42545)

Utilizator AlxCojocaru Alexandru Alx Data 29 martie 2007 12:01:13
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <stdio.h>
using namespace std;
char c;
long nrc,nrcv;
int main()
{
 freopen("text.in","r",stdin);
 freopen("text.out","w",stdout);
 c=fgetc(stdin);
 int cuv=0;
 while (c!=EOF)
 {
  if ((c>='A'&&c<='Z')||(c>='a'&&c<='z'))
  {
   cuv=1;
   nrc++;
  }
  else
   if (cuv)
   {
	nrcv++;
	cuv=0;
   }
  c=NULL;
  c=fgetc(stdin);
 }
 if (nrcv==0)
  if (nrc)
   printf("1\n");
  else
   printf("0\n");
 else
  printf("%ld\n",nrc/nrcv);
 return 0;
}