Cod sursa(job #2630339)

Utilizator Wister1043Silaghi Razvan-Andrei Wister1043 Data 25 iunie 2020 13:25:50
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <iostream>
#include <fstream>
#include <cstring>

using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");


int main()
{
    string text;
    getline(fin, text);
    int i=0,s=0,nr=0;
    bool first=true;
    while(i<text.length())
    {
        if((text[i] >= 'a' && text[i] <= 'z') ||(text[i] >= 'A' && text[i] <= 'Z'))
        {
            s++;
            if(first == true)
            {
                nr++;
                first = false;
            }
        }
        else
        {
            first = true;
        }
        i++;
    }
    fout<<s/nr;
    return 0;
}