Cod sursa(job #2889102)

Utilizator lungubiancaBia Lungu lungubianca Data 12 aprilie 2022 11:36:24
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <iostream>
#include <cstring>
#include <fstream>

using namespace std;
ifstream in("text.in");
ofstream out("text.out");

int main()
{
    char t[101],s1[]=" .,?!-:;'/";
    long long l=0,c=0;

    in.getline(t,101);
    for(long long i=0; i<strlen(t); i++)
        if(strchr(s1,t[i]))
            l++;
    if(l==strlen(t))
        out<<0;
    else
    {
        l=strlen(t)-l;
        char *p=strtok(t,s1);
        while(p)
        {
            c++;
            p=strtok(NULL,s1);
        }
        out<<l/c;
    }
    return 0;
}