Pagini recente » Cod sursa (job #2683209) | Cod sursa (job #3178722) | Cod sursa (job #2116911) | Cod sursa (job #1015710) | Cod sursa (job #2764594)
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream in("text.in");
ofstream out("text.out");
bool letter(char c) {
if ('a' <= c && c <= 'z')
return 1;
if ('A' <= c && c <= 'Z')
return 1;
return 0;
}
int main() {
int cnt_cuv=0, cnt_litere=0;
char s[500000];
in.getline(s, 450000);
for (int i = 0; i < strlen(s); i++) {
if (letter(s[i])) {
cnt_cuv++;
while (i < strlen(s) && letter(s[i])) {
cnt_litere++;
i++;
}
}
}
out << cnt_cuv / cnt_litere;
}