Cod sursa(job #1595321)

Utilizator ArceyGeorge Cioroiu Arcey Data 10 februarie 2016 10:40:19
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.95 kb
#include <cstdio>
#include <iostream>
#include <set>
#include <climits>
#include <map>
#include <algorithm>
#include <list>
#include <vector>
#include <utility>
#include <cstdlib>
#include <iomanip>
#include <cstring>
#include <string>

using namespace std;

bool isChar(char c) {
    return (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')));
}

int main() {
  //  freopen("tt.txt", "r", stdin);
    freopen("text.in", "r", stdin);
    freopen("text.out", "w", stdout);

  //  ios::sync_with_stdio(false);
  //  cin.tie(0);



    bool isWord = false;
    int totalWord = 0, totalChar = 0;
    char c;
    while (true) {
        c = getchar();
        if (isChar(c)) {
            isWord = true;
            totalChar++;
        } else if (isWord) {
            isWord = false;
            totalWord++;
        }
        if (c == -1)
            break;
    }

    cout << totalChar / totalWord;


    return 0;
}