Cod sursa(job #1661294)

Utilizator StefanIordacheIordache Stefan Andrei StefanIordache Data 23 martie 2016 19:29:18
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.67 kb
#include <iostream>
#include <string.h>
#include <fstream>

using namespace std;

int main()
{
    char c;
    int i,a=0,b=0;
    bool ok=false;
    ifstream in("text.in");
    ofstream out("text.out");
    while(in>>noskipws>>c)
    {
        if(c>='a' && c<='z' || c>='A' && c<='Z' )
        {
            if(ok==true)
            {
                a++;
            }
            if(ok==false)
        {
                a++;
                b++;
                ok=true;
        }
        }
        else
        {
            ok=false;
        }
    }
    if(b==0)
    {
        cout<<'0';
        return 0;
    }
    out<<a/b;
    return 0;
}