Cod sursa(job #1385339)

Utilizator Dragne.Andrei11Dragne Andrei Dragne.Andrei11 Data 11 martie 2015 21:30:32
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <cstdio>
#include <cctype>
#include <cstring>
#define nmax 1000000

using namespace std;

char s[nmax], *p, sep[]=" +-,.?!1234567890;", s1[nmax];
int main()
{
    freopen("text.in", "r", stdin);
    freopen("text.out", "w", stdout);
    int n, i, nrcuv=0, nrl=0;

    gets(s);
    n=strlen(s);
    strcpy(s1, s);
    p=strtok(s, sep);
    while(p)
    {
        nrcuv++;
        p=strtok(NULL, sep);
    }
    for(i=0;i<n;i++)
    {
        if(islower(s1[i])!=0||isupper(s1[i])!=0)
            nrl++;
    }
    printf("%d\n", nrl/nrcuv);

    return 0;
}