Cod sursa(job #499014)

Utilizator bocacristiBoca Nelu Cristian bocacristi Data 8 noiembrie 2010 12:37:18
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <fstream>
#include <cstring>
using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

int main()
{
	char a[20];
	int n = 0, c = 0;
	int m = 0;
	while ( fin >> a )
	{
		c++;
		n += strlen(a);
		if ( strlen(a) == 1 && a[0] == '-' )
			n--, c--;
		m = strlen(a);
		for ( int i = 0; i < n; i++ )
			if ( i > 0 && i < n  && a[i] == '-' )
				c++;
	}
	fout << n/c;
}