Cod sursa(job #1513071)

Utilizator adimAlexander Dmitriev adim Data 28 octombrie 2015 22:40:56
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <fstream>
#include <iostream>
#include <cstring>

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

int main() {

      char x;
      int total = 0;
      int words = 0;
      bool should = false;
      while (f>>noskipws>>x) {
            if ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z')) {
                  total++;
                  should = true;
            } else if (should) {
                  should = false;
                  words++;
            }
      }

      g<<total/words<<endl;

      f.close(); g.close();
      return 0;
}