Cod sursa(job #1821483)

Utilizator alexandra_paticaAndreea Alexandra Patica alexandra_patica Data 3 decembrie 2016 11:10:19
Problema Text Scor 40
Compilator cpp Status done
Runda x_test2 Marime 0.42 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream cin ("text.in");
ofstream cout ("text.out");

int n, nr, s;
char c[1048577], aux[1048577], *p;
int main ()
{
    cin.getline(c, 1048577);
    p=strtok(c, " ,.-!?*;:");
    nr=0;
    s=0;
    while (p){
        nr++;
        strcpy(aux, p);
        s=s+strlen(aux);
        p=strtok(NULL, " ,.-!?*:;");
    }
    cout << s/nr;
    return 0;
}