Cod sursa(job #2847633)
Utilizator | Data | 11 februarie 2022 10:28:27 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char sep[256];
const int MAX=1e6+5;
int nrcuv,nrlit,k;
char ch[MAX],*p;
int main()
{
for(int i=1;i<256;i++)
if(!isalpha(i))
sep[k++]=i;
fin.getline(ch,MAX);
p=strtok(ch,sep);
while(p)
{
nrlit+=strlen(p);
nrcuv++;
p=strtok(NULL,sep);
}
fout << nrlit/nrcuv;
return 0;
}