Cod sursa(job #1090560)

Utilizator ovidel95Ovidiu ovidel95 Data 22 ianuarie 2014 20:03:02
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <fstream>
#include<cstring>
#define LUN 1500000
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,"012345678"" -,./%*<+=^@$`~#&>!?:;''_\()9");
    while(p!=NULL)
    {
        c++;
        sum+=strlen(p);
        p=strtok(NULL,"012345678"" -,./%*<^`~@#$&+=>!?:;""''_()\9");
    }
    if(c!=0)
        g<<sum/c;
    else
        g<<0;
    f.close();
    g.close();
    return 0;
}