Cod sursa(job #2203512)

Utilizator AndrulianDin Iulian Andrulian Data 12 mai 2018 16:15:56
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <bits/stdc++.h>

using namespace std;
char c[1200];
char sep[]=". , - ; ! ? ) ( ' \ = / * & ^ % $ # @ } { | < > _ ";
int n,lungime,cuvinte;
ifstream fin("text.in");
ofstream fout("text.out");
//int litera()
int main()
{
    fin.get(c,1200);
    char *p=strtok(c,sep);
    //  cout<<c;
    while(p!=NULL)
    {
        //  cout<<p<<endl;
        cuvinte++;
        n=strlen(p);
        lungime=lungime+n;
        p=strtok(NULL,sep);
    }
    // fout<<cuvinte<<" "<<lungime<<"\n";
    if(cuvinte==0)fout<<0;
    else
        fout<<lungime/cuvinte;
    return 0;
}