Cod sursa(job #2062225)

Utilizator HesusIonescu Andrei Paul Hesus Data 10 noiembrie 2017 09:16:19
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char S[100001];
int leng,cuv,lm;
char sep[]=",.!:;? ";
int main()
{
    fin.getline(S,100001);
    for(int i = 0 ; S[i]!=0 ;i++)
    {
        if(isalpha(S[i])!=0)
            leng++;
    }
    char *p;
    p=strtok(S,sep);
    while(p)
    {
        cuv++;
        p=strtok(NULL,sep);
    }
    lm=leng/cuv;

    fout<<lm;
}