Pagini recente » Cod sursa (job #1457225) | Cod sursa (job #3269831) | Cod sursa (job #1660793) | Cod sursa (job #2362422) | Cod sursa (job #1459231)
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream in("text.in");
ofstream out("text.out");
int main() {
char text[10000];
cin.get(text, 10000);
int cuvinte = 0, nr_cuvinte = 0;
bool cuvant = false;
for (int i = 0; i <= strlen(text); i++) {
if (cuvant == true) {
if ((text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'z')) {
nr_cuvinte++;
} else {
cuvant = false;
}
} else {
if ((text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'z')) {
nr_cuvinte++;
cuvinte++;
cuvant = true;
}
}
}
cout << nr_cuvinte/cuvinte;
in.close();
out.close();
return 0;
}