Cod sursa(job #2216166)
Utilizator | Data | 25 iunie 2018 18:09:34 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <cstring>
using namespace std;
#include <fstream>
int main()
{
ifstream f("text.in");
ofstream g("text.out");
char s[5001],*p,sep[]=",. !?-:;'";
int suma=0,nr=0;
f.get(s,5000);
p=strtok(s,sep);
while (p)
{
suma+=strlen(p);
nr++;
p=strtok(NULL,sep);
}
g<<suma/nr;
f.close();
g.close();
return 0;
}