Cod sursa(job #782652)

Utilizator RadulescuSerbanRadulescu Serban RadulescuSerban Data 28 august 2012 15:45:52
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.67 kb
#include <fstream>
#include <cstdio>

using namespace std;

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

bool litera(char a)
{
    if(a>='a' && a<='z') return true;
    if(a>='A' && a<='Z') return true;
    return false;
}
int main()
{
    char t,u;
    int nr = 0,n = 0;
    //in >> u;
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    scanf("%c",&u);
    if(litera(u)) n++;
    //while(in >> t)
    while(scanf("%c",&t)!=EOF)
    {
        if(litera(t))
        {
            nr++;
            if(!litera(u)) n++;
        }
        u = t;
    }
    //out << nr << " " << n;
    printf("%d", nr/n);
    return 0;
}