Pagini recente » Cod sursa (job #629246) | Cod sursa (job #1756942) | Cod sursa (job #2242054) | Cod sursa (job #2244106) | Cod sursa (job #2703221)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
int main()
{
char c;
int nr=0, lungime=0, nrcuvinte=0;
while(fin.get(c)){
if(isalpha(c)){
nr++;
}
else{
if(nr>0){
lungime+=nr;
nrcuvinte++;
}
nr=0;
}
}
if(nr>0){
lungime+=nr;
nrcuvinte++;
}
if(nrcuvinte!=0)fout<<lungime/nrcuvinte;
else fout<<0;
return 0;
}