Pagini recente » Cod sursa (job #291774) | Cod sursa (job #168934) | Cod sursa (job #1703326) | Cod sursa (job #1531788) | Cod sursa (job #1546326)
#include <iostream>
#include <fstream>
#include <string.h>
//#include <vector>
//#include <queue>
//#include <algorithm>
using namespace std;
const int nmax = 2000000; //1 048 576
char s[nmax];
inline int e_litera(char t) {
if ('a' <= t && t <= 'z' || 'A' <= t && t <= 'Z') return true;
return false;
}
int main(){
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
fgets(s, nmax, stdin);
unsigned long long litere = 0, nrCuvinte = 0;
int p = 0;
for (int i = 0; s[i] != '\0'; i++) {
if (e_litera(s[i])) {
if (!p) {
p = 1; nrCuvinte++;
}
else p++;
}
else {
if (p){
litere += p; p = 0;
}
};
}
// if (!p) litere += p;
/*
if (nrCuvinte == 0) {
printf("%lld ", 0);
return 0;
}
*/
printf("%lld ", litere / nrCuvinte);
fclose(stdin);
fclose(stdout);
return 0;
}