Cod sursa(job #2276318)
| Utilizator | Data | 4 noiembrie 2018 16:32:24 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream intrare("text.in");
ofstream iesire("text.out");
int main()
{
int nr=1,i;
const long int NMAX=1048577;
char sir[NMAX];
char *p,cuv[10000][100];
char del[7]= {',',' ','.','!','?','-','/'};
long long int s=0;
intrare.get();
intrare.get(sir,NMAX);
p=strtok(sir,del);
while(p!=NULL)
{
strcpy(cuv[nr],p);
nr++;
s+=strlen(p);
p=strtok(NULL,del);
}
if(nr-1!=0)
iesire<<s/(nr-1);
else
iesire<<-1;
return 0;
}
