Cod sursa(job #211262)

Utilizator EdeNNu Cred EdeN Data 1 octombrie 2008 16:58:34
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.83 kb
#include <iostream>

using namespace std;

char c;
long nr,i;
bool k;

void scan()
{
    freopen("text.in","r",stdin);
    nr=0;
    i=0;
    while (!feof(stdin))
        {
            scanf("%c",&c);
            if (((c>='A') && (c<='Z')) || ((c>='a') && (c<='z')))
                {
                    nr++;
                    if(!k) i++;
                    k=true;
                }
            else k=false;
        }
}

void writeit()
{
    freopen("text.out","w",stdout);
    printf("%ld", nr/i);
}

int main()
{
    scan();
    writeit();
    return 0;
}

  /* while (!feof(stdin))
     {
         scanf("%c",&c);
         if (('a'<=c && c<='z') || ('A'<=c && c<='Z'))
         {
             len++;
             if (!k) cuv++;
             k=1;
         }
         else k=0;
     }
*/