Cod sursa(job #2703219)
Utilizator | Data | 7 februarie 2021 17:54:16 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#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) && c!=EOF){
if(isalpha(c)){
nr++;
}
else{
if(nr>0){
lungime+=nr;
nrcuvinte++;
}
nr=0;
}
}
if(nrcuvinte!=0)fout<<lungime/nrcuvinte;
else fout<<0;
return 0;
}