Cod sursa(job #1090554)

Utilizator ovidel95Ovidiu ovidel95 Data 22 ianuarie 2014 19:55:57
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <fstream>
#include<cstring>
#define LUN 2000000
using namespace std;

int main()
{
    ifstream f("text.in");
    ofstream g("text.out");
    char s[LUN];
    f.get(s,LUN);
    char *p;
    int c=0,sum=0;
    p=strtok(s,"0123456789 -,./%*<>!?");
    while(p!=NULL)
    {
        c++;
        sum+=strlen(p);
        p=strtok(NULL,"0123456789 -,./%*<>!?");
    }
    g<<sum/c;
    f.close();
    g.close();
    return 0;
}