Cod sursa(job #2223000)

Utilizator IMIR33Iacob-Mare Ionut Radu IMIR33 Data 18 iulie 2018 19:58:06
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <iostream>
#include <fstream>
#include <string.h>

using namespace std;

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

char s[1000000];

int main()
{
    char sep[]=".,?! -",*p,cuv[20];
    int k=0,n=0;
    f.get(s,256);
    while((s[0]<'a' || s[0]>'z') && (s[0]<'A' || s[0]>'Z'))
        strcpy(s,s+1);
    p=strtok(s,sep);
    while(p!=NULL)
    {
        strcpy(cuv,p);
        k=k+strlen(cuv);
        n++;
        p=strtok(NULL,sep);
    }
    g<<k/n;
    return 0;
}