Cod sursa(job #2596360)
Utilizator | Data | 9 aprilie 2020 17:20:59 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char text[1000],*p,sep[]=" -,!?.;/\'[]{}()* ";
int n=0,k=0;
f.get(text,1000);
p=strtok(text,sep);
while (p)
{
k+=strlen(p);
n++;
p=strtok(NULL,sep);
}
g<<k/n;
return 0;
}