Cod sursa(job #3137053)

Utilizator AlexSerban21Serban Alexandru AlexSerban21 Data 10 iunie 2023 20:35:00
Problema Text Scor 70
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <fstream>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
int i,nrs,nrlg,cv;
char s[5000003];
int main()
{
    while (fin.getline (s,5000000))
    {
        for (i=0; s[i]; i++)
        {
            if ((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
            {
                nrs++;
                nrlg++;
            }
            else if (nrs>0)
            {
                nrs=0;
                cv++;
            }
        }
    }
    if (nrs>0)
        cv++;
    if (cv!=0)
        fout<<nrlg/cv;
    else
        fout<<0;
    return 0;
}