Cod sursa(job #1821489)

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

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