Cod sursa(job #2241918)
Utilizator | Data | 17 septembrie 2018 14:35:41 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
char c;
int wcount = 0, length = 0;
bool separator = false;
ifstream f ("text.in");
ofstream g ("text.out");
while(f.get(c)){
if(('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')){
length ++;
separator = true;
}
else if (separator == true){
wcount ++;
separator = false;
}
}
if(!length)
g<<'0';
else
g<< length/wcount;
f.close();
g.close();
return 0;
}