Cod sursa(job #1976576)

Utilizator workwork work work Data 3 mai 2017 19:39:48
Problema Text Scor 40
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[10000010];

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