Cod sursa(job #1603187)
Utilizator | Data | 17 februarie 2016 11:48:22 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
char t[1000],*p,sep[]=".,- ?!";
int nr=0, l=0;
fin.getline(t,1000);
p=strtok(t,sep);
while(p)
{
nr++;
l=l+strlen(p);
p=strtok(NULL,sep);
}
fout<<l/nr;
return 0;
}