Cod sursa(job #1231929)

Utilizator AcuasPopescu Nicolae-Aurelian Acuas Data 21 septembrie 2014 18:59:38
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
#include <fstream>
#include <cstring>
#include <cctype>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char a[1001],v[400],*p;
int i,k,s;
int main()
{
    f.getline(a,1000);
    for(i=0;i<strlen(a);i++)
        if(!isalpha(a[i]))
        v[k++]=a[i];
    k=0;
    p=strtok(a,v);
    while(p)
    {
        s+=strlen(p);
        k++;
        p=strtok(NULL,v);
    }
    g<<s/k<<endl;
    return 0;
}