Cod sursa(job #2190343)

Utilizator gabiborleaGabriel Borlea gabiborlea Data 30 martie 2018 16:37:48
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char s;
int sum=0,nr=0,ok=0;
int main()
{
    while(fin.get(s))
    {
        if(s>='a' && s<='z' or s>='A' && s<='Z')
        {
            ok=1;
            sum++;
        }
        else if(ok>0)
        {
            ok=0;
            nr++;
        }
    }
    if(ok>0) nr++;
    fout<<sum/nr;

}