Cod sursa(job #2169381)

Utilizator IoanStoicaStoica Ioan IoanStoica Data 14 martie 2018 15:06:18
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
    ifstream f("text.in");
    ofstream g("text.out");
    char c,trecut='0';unsigned long long s=0,n=0;
    f>>noskipws>>trecut;
    if((trecut>='a' && trecut<='z') || (trecut>='A' && trecut<='Z'))
        s++;
    while(f>>noskipws>>c)
        if((c>='a' && c<='z') || (c>='A' && c<='Z'))
        {
            s++;trecut=c;
        }

        else
            if((trecut>='a' && trecut<='z') || (trecut>='A' && trecut<='Z'))
            {
                n++;
                trecut=c;
            }
    g<<s/n;
    f.close ();
    g.close ();
}