Cod sursa(job #1402040)

Utilizator DeehoroEjkoliPop Darian DeehoroEjkoli Data 26 martie 2015 11:52:15
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <iostream>
#include <fstream>
using namespace std;

ifstream f("text.in");
ofstream g("text.out");
string v;
int letters, words, lastLetter = '#';

bool isLetter(char x) {
    return ('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z');
}

int main()
{
    while(!f.eof()) {
        char x = f.get();

        for (int i=0; i<v.size(); i++) {
            if (isLetter(x) && !isLetter(lastLetter)) words++;
            if (isLetter(x)) letters++;
            lastLetter = x;
        }
    }
    g<<letters/words<<"\n";
    return 0;
}