Cod sursa(job #1127889)

Utilizator Cristian1997Vintur Cristian Cristian1997 Data 27 februarie 2014 14:12:42
Problema Text Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
using namespace std;
#include <fstream>
#include <string.h>
ifstream fin("text.in");
ofstream fout("text.out");

#define Nmax 100000000

char sep[]="0123456789 !@.,-_\/*+";
char sir[Nmax+1];

int main()
{
    int nrcuv=0, lg=0;
    char *p, *q;
    fin.getline(sir, Nmax+1);
    p=strtok(sir, sep);
    do
    {
        nrcuv++; q=p;
        while(q && ((*q>='a' && *q<='z') || (*q>='A' && *q<='Z'))) q++;
        lg+=q-p;
        p=strtok(NULL, sep);
    }
    while(p);
    fout<<lg/nrcuv;
    return 0;
}