Cod sursa(job #2270164)
| Utilizator | Data | 27 octombrie 2018 09:46:24 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{ char a[1000],*p,sep[970];
int i,lungime=0,nrcuv=0,lv=0;
bool ok;
for(i=0;i<=1000;i++)
{ok=1;if((char(i)>='a'&&char(i)<='z')||(char(i)>='A'&&char(i)<='Z')) ok=0;
if(ok==1) sep[lv++]=char(i);}
f.get(a,1000);
p=strtok(a,sep);
while(p)
{
nrcuv++;
lungime=lungime+strlen(p);
p=strtok(NULL,sep);
}
g<<lungime/nrcuv<<'\n';
return 0;
}
