Cod sursa(job #915853)

Utilizator tipitzaCarausu Ioana tipitza Data 15 martie 2013 13:36:05
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <iostream>
#include<fstream>
#include<string.h>
using namespace std;

int main()
{
    ifstream f;
    ofstream g;
    f.open("text.in");
    g.open("text.out");
    char s[256], *p, e[]=" ,.!?;:(){}[]/\-""";
    int i,k,n=0,c=0;
    f.get(s,256);
    i=0;
    while(isalpha(s[i])==0)
        i++;
    strcpy(s,s+i);
    p=strtok(s,e);
    while(p)
    {
        c++;
        n+=strlen(p);
        p=strtok(NULL, e);
    }
    k=n/c;
    g<<k;
    return 0;
}