Cod sursa(job #807592)

Utilizator Anca_PaneaPanea Anca Anca_Panea Data 4 noiembrie 2012 23:15:53
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
using namespace std;
#include<fstream>
#include<ctype.h>
#include<string.h>
ifstream eu("text.in");
ofstream tu("text.out");
int main()
{
	char x[250000],sep[]=" ,:;!?-\n.()%^&*@~/-+=|><";
	char *p;
	int s=0,k=0,S,i;
	eu.get(x,250000);
	for(i=1;x[i];i++)
		if(x[i]==x[i-1])
		{
			strcpy(x+i,x+i+1);
			i--;
		}
	p=strtok(x,sep);
	while(p)
	{
		s=s+strlen(p);
		k++;
		p=strtok(NULL,sep);
	}
	S=s/k;
	tu<<S;
	return 0;
}