Cod sursa(job #1235740)

Utilizator serbanSlincu Serban serban Data 30 septembrie 2014 14:52:05
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>
#include <cstring>

using namespace std;

int n,k;
char a[100000],*p;

int main()
{
    FILE *f=fopen("text.in","r");
    FILE *g=fopen("text.out","w");
    fgets(a,100000,f);
    p=strtok(a," \n=-.,;:~`");
    while(p)
    {
        k++;
        n+=strlen(p);
        p=strtok(NULL," \n=-.,;:~`");
    }
    fprintf(g,"%d\n",(n/k));
    return 0;
}