Cod sursa(job #1982395)

Utilizator MihneaMihnea300Mihnea Andreescu MihneaMihnea300 Data 18 mai 2017 17:32:23
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <fstream>
#include <cstring>

using namespace std;

ifstream F("text.in");
ofstream G("text.out");

int cuv, kcuv, klit, n;
char c;

int main()
{
    while(F)
    {
        F.get(c);
        {
            if((c >= 'a' && c<= 'z') || (c >= 'A' && c <= 'Z'))
            {
                if(!cuv)
                    ++kcuv, cuv = 1;
                ++ klit;
            }
            else
            {
                if(cuv)
                    cuv = 0;
            }
        }
    }
    if(!kcuv)
        G << "0";
    else
        G << klit / kcuv;
    return 0;
}