Cod sursa(job #1997189)
| Utilizator | Data | 3 iulie 2017 16:38:02 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <fstream>
#include <cstring>
#define nmax 101
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
void Solve()
{char s[10001],*p,cuv[10001],sep[]="~`!@#$%^&*()_-+={}[]:;'<>?,./|\1234567890 ";
int sum=0,nr=0;
fin.getline(s,10001);
p=strtok(s,sep);
while(p!=NULL)
{strcpy(cuv,p); p=strtok(NULL,sep);
sum+=strlen(cuv);
nr++;
}
if(nr>0) fout<<sum/nr<<endl;
else fout<<0<<endl;
}
int main()
{Solve();
return 0;
}
