Cod sursa(job #1554113)

Utilizator AlexEnacheEnache Alexandru-Paul AlexEnache Data 20 decembrie 2015 22:09:40
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.36 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[100],*p,ss[100];
int l=0,nr=0;
int main ()
{
    f>>s;
    p=strtok(s," -!?");
    while (p!=NULL)
    {
        nr++;
        strcpy (ss,p);
        l=l+strlen(ss);
        p=strtok(NULL," -!?");
    }
        g<<l/nr;
    return 0;
}