Cod sursa(job #2567013)

Utilizator rareshinnhoMiroiu Rares rareshinnho Data 3 martie 2020 14:31:34
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <fstream>

using namespace std;

ifstream cin("text.in");
ofstream cout("text.out");


int main()
{
    int words = 0;
    int cnt=0;
    char c;
    bool pci, ci;
    cin>>c;
    pci = ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
    if(pci)
        words++, cnt++;
    while(cin.get(c)) {
       // cout << c << " ";
        ci = ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
        if(ci)
            cnt++;
        if(!pci && ci)
            words++;
        pci = ci;
    }
    cout << cnt / words;


    return 0;
}