Cod sursa(job #3276219)

Utilizator iStefan703Bordei Stefan iStefan703 Data 12 februarie 2025 22:16:22
Problema Text Scor 20
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.36 kb
#include<fstream>
#include<cstring>
using namespace std;

ifstream f("text.in");
ofstream g("text.out");

char c[1000001];
int main()
{
	int nr_cuv = 1, lungime_cuv = 0;
	f.get(c, 1000001);
	char* p = strtok(c, " -.?/';:<>!()");
	while (p)
	{
		lungime_cuv += strlen(p);
		nr_cuv++;
		p = strtok(NULL, " -.?/';:<>!()");
	}
	g << lungime_cuv / nr_cuv;
}