Cod sursa(job #1597071)

Utilizator VvesVictor Vlad Vves Data 11 februarie 2016 17:22:01
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <iostream>
#include <fstream>	
#include <string.h>
using namespace std;

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

int main ()
{
	//char str[] ="- Lasa-ma in pace, ca am invatat azi noapte toata ziua!";
	char str[100];
	fin >> str;
  	char * pch;
	int nrcuv=0;
  //	printf ("Splitting string \"%s\" into tokens:\n",str);
  	pch = strtok (str," ,.-");
	int nr=0;nr=0;
  	while (pch != NULL)
  	{
		nr+=strlen(pch);
		nrcuv++;
    		pch = strtok (NULL, " ,.-");
  	}	
	fout << nr/nrcuv;
	return 0;
}