Cod sursa(job #2237632)

Utilizator Pami1928Popescu Andrei Gabriel Pami1928 Data 2 septembrie 2018 14:34:51
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");

int main(){ 
   vector<int> words;
   string word;
   while(!fin.eof()){
   	fin >> word;
	words.push_back(word.length());
   }
   
   int total = 0;
   for(int i = 0;i < words.size()-1;i++){
   	total += words[i];
   }
   fout << (int)(total/words.size());

   fin.close();
   fout.close();	

return 0;	
}