Cod sursa(job #1878655)

Utilizator cr34tivMagdalin Stefan cr34tiv Data 14 februarie 2017 12:45:22
Problema Text Scor 60
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

int lgmax=0,nrcuv=0,lgmedie=0;
char s[1001];
int main()
{
    while(f.getline(s,1001))
    {
    char *p=strtok(s," .,;/?-!_+=");
    while(p)
    {
        lgmax+=strlen(p);
        nrcuv+=1;
        p=strtok(NULL," .,;/?-!_+=");
    }
    }
    lgmedie=lgmax/nrcuv;
    g<<lgmedie;
    f.close();
    g.close();
    return 0;
}