Cod sursa(job #487725)
#include <fstream.h>
#include <string.h>
#include <iostream.h>
ifstream f ("text.in");
ofstream g ("text.out");
int main ()
{
char text[100000],*p,aux[100000];
int i,contc=0,contl=0,c=0;
f.get (text,256);
p=strchr(text,'-');
while (p)
{
strcpy(aux,p+1);
strcpy(p," ");
strcat(p+1,aux);
p=strchr(p,'-');
}
while (!isalpha(text[0])) strcpy(text,text+1);
p=strchr(text,'.,!?:;');
while (p)
{
strcpy(p,p+1);
p=strchr(p,'.,!?:;');
}
for (i=0;i<strlen(text);i++)
{
if (isalpha(text[i])) contl++;
if (isspace(text[i])) contc++;
}
contc++;
g<<contl/contc;
return 0;
}