Cod sursa(job #1597366)

Utilizator kassay_akosKassay Akos kassay_akos Data 11 februarie 2016 22:04:01
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.77 kb
#include <iostream>
#include <fstream>
#include <string.h>
 
using namespace std;
const int nmax = 2000000; //1 048 576
char c;//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);
    int litere = 0, nrCuvinte = 0;
    int k = 0;
	bool q = true ;
	while (q) {
		c = getchar();
	    if (e_litera(c)) {
			litere++;
            if (k==0) {
                k = 1; 
				nrCuvinte++;
            }
        }
        else {
			k = 0;
        };
		if (c==-1) break ;
    }
    printf("%d ", litere / nrCuvinte);
    fclose(stdin);
    fclose(stdout);
    return 0;
}