Cod sursa(job #2494755)
Utilizator | Pop Denis Denisz | Data | 18 noiembrie 2019 13:02:38 |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <algorithm>
#include <cstring>
#include <fstream>
using namespace std;
int main()
{
ifstream fin("text.in");
ofstream fout("text.out");
char s[100],sep[]=" -,.;:!?'";
char *p;
int nrcuv=0,lungcuv=0;
fin.get(s,100);
p=strtok(s,sep);
while(p!=NULL)
{
lungcuv+=strlen(p);
nrcuv++;
p=strtok(NULL,sep);
}
fout<<lungcuv/nrcuv;
return 0;
}