Cod sursa(job #2261400)
Utilizator | Data | 16 octombrie 2018 10:49:59 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[502],sep[7]=" -.,?!",*p,aux[501];
int n,i=-1,k,j,c;
int main()
{
while(f.getline(s,501))
{p=strtok(s,sep);
while(p)
{k++;
c+=strlen(p);
p=strtok(NULL,sep);
}
}
g<<c/k;
return 0;
}