Cod sursa(job #2652131)
Utilizator | Capatina Razvan Nicolae Razvan48 | Data | 24 septembrie 2020 13:43:03 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <fstream>
#include <cstring>
using namespace std;
const int NMAX = 1000000;
char propozitie[1 + NMAX];
char sep[] = "!,.;:?- ";
int main()
{
ifstream in("text.in");
ofstream out("text.out");
int sum = 0, nr_cuv = 0;
in.getline(propozitie, 1 + NMAX);
char* p = strtok(propozitie, sep);
while (p)
{
nr_cuv++;
sum += strlen(p);
p = strtok(NULL, sep);
}
out << sum / nr_cuv;
return 0;
}