Cod sursa(job #1792474)
Utilizator | Data | 30 octombrie 2016 14:59:30 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.53 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main() {
char a;
int nr_caractere = 0;
int spaces = 0;
int result = 0;
bool in_cuvant = false;
fin >> a;
while(a != EOF){
if ((a >= 65 && a <= 90) || (a >= 97 && a <= 122)){
nr_caractere++;
in_cuvant = true;
}else if(in_cuvant == true){
spaces++;
in_cuvant = false;
}
fin>>a;
}
result = nr_caractere/spaces;
fout << result;
fin.close();
fout.close();
return 0;
}