Cod sursa(job #1415325)

Utilizator witselWitsel Andrei witsel Data 4 aprilie 2015 12:19:05
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char last,now;
int nrCuvinte,nrLitere;
int main()
{
    fin.get(last);
    if( (last>='a' && last<='z') || (last>='A' && last<='Z') )
        nrLitere++;
    while( fin.get(now) )
    {

        if( ( now>='a' && now<='z') || (now>='A' && now<='Z') )
            {
                nrLitere++;
            }
        else
            if((last>='a' && last<='z') || (last>='A' && last<='Z'))
                nrCuvinte++;
        last=now;
    }
    if(nrCuvinte)
        fout<<nrLitere/nrCuvinte;
    return 0;
}