Cod sursa(job #42550)

Utilizator AlxCojocaru Alexandru Alx Data 29 martie 2007 12:05:15
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 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
  if (!cuv)
   printf("%ld\n",nrc/nrcv);
  else
   printf("%ld\n",nrc/(nrcv+1));
 return 0;
}