Cod sursa(job #2451806)

Utilizator davidcotigacotiga david davidcotiga Data 28 august 2019 12:06:41
Problema Text Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.4 kb

#include <iostream>
#include <string>
#include <fstream>
using namespace std;

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

	char ch;
	int let = 0, word = 0, k = 0;
	
	fin.get(ch);
	
	while (ch != '\0') {
		
		if (isalpha(ch))
			++let;
		if (k == 0) {
			word++;
			k = 1;
		}
		else
			k = 0;

		fin.get(ch);
	}
	
	fout << let / word;

	return 0;
}