Cod sursa(job #1418741)

Utilizator ArkinyStoica Alex Arkiny Data 13 aprilie 2015 21:35:42
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include<fstream>
#include<iostream>
#include<string.h>
using namespace std;

char special[]=" !@#$%^&*()_-=+{[}]|\\:;\"'<,>.?/~`\n0123456789";
char s[1073741860];
int main()
{

	ifstream in("text.in");
	ofstream out("text.out");
	char c,ns=0;
	while(!in.eof())
		in.get(c),s[ns++]=c;
	
	s[ns]='\n';
	int nr=0,l=0;
	char *p=strtok(s,special);
	while(p)
	{
	  int t=strlen(p);
	  if(t>1)
	  {
	   l=l+t;
	   ++nr;
	  }
	   p=strtok(NULL,special);
	}
	out<<l/nr;
	return 0;
}