Cod sursa(job #1197584)
Utilizator | Data | 12 iunie 2014 20:15:15 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<fstream>
#include<iostream>
#include<string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int k=0,nr=0,i;
char *p,a[10001]="",b[11]=" -:.;',?! ";
int main()
{
f.getline(a,10000);
while(a[0]=='-'||a[0]=='"'||a[0]==' ')
strcpy(a,a+1);
p=strtok(a,b);
while(p)
{cout<<p<<endl;
nr+=strlen(p);
k++;
p=strtok(NULL,b);
}
if(k)
g<<(int)nr/k<<' '<<nr<<' '<<k;
f.close();
g.close();
return 0;
}