Cod sursa(job #1554342)

Utilizator andreinmAndrei andreinm Data 21 decembrie 2015 12:03:44
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <cstdio>
#include <cstring>
#include <cctype>
using namespace std;
char s[256] , *p , sep[20] = " ,-?!@#$^%&*(+=)_";
int n , c;
int main()
{
    freopen ("text.in" , "r" , stdin);
    freopen ("text.out" , "w" , stdout);

    gets (s);
    for (int i = 0 ; i < strlen (s) ; ++i)
        (isalpha(s[i])) ? c++ : c;
    p = strtok (s , sep);
    while (p)
    {
        n++;
        p = strtok (NULL , sep);
    }
    printf ("%d" , c / n);
    return 0;
}