Cod sursa(job #1791604)
Utilizator | Data | 29 octombrie 2016 15:36:28 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include<iostream>
#include<fstream>
#include<cstring>
using namespace std;
fstream fin("text.in",ios::in),fout("text.out",ios::out);
char x[1000],*p;
int main()
{
int s=0,nrc=0;
fin.getline(x,1000);
p=strtok(x," ,-");
while(p!=0)
{
nrc++;
s+=strlen(p);
p=strtok(0," ,.!-");
}
fout<<s/nrc;
fin.close();
fout.close();
return 0;
}