Cod sursa(job #2894172)

Utilizator VlodiefVlosta Vlodief Data 27 aprilie 2022 14:32:48
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <iostream>
#include <cstring>
#include <fstream>

using namespace std;


ifstream f("text.in");
ofstream g("text.out");

int main()
{
    char s[1000001];
    int ctLit=0,ctcuv=0,ok=1,pozi;
    f.get(s,1000001);
    char sep[]=" -,!?";
    for(int i=0; i<strlen(s); i++)
        if(isalnum(s[i]))
            ctLit++;
    char * p = strtok(s , sep);
while(p != NULL)
{
    ctcuv++;
    p = strtok(NULL , sep);
}

    //cout<<ctLit<<" "<<ctcuv<<endl;
  //  cout<<ctLit<<" "<<ctcuv;
    g<<ctLit/ctcuv;
    return 0;
}