Cod sursa(job #1557823)

Utilizator Belu99Bibo Bela Belu99 Data 28 decembrie 2015 12:43:26
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.68 kb
#include <iostream>
#include <fstream>
using namespace std;
bool k=true;
string s;
long x=0,i,n,q=0,x1=0;
int main()
{
    ifstream f("text.in");
    ofstream g("text.out");
    while(!f.eof())
    {
    getline(f,s);
    n=s.size();
    for(i=0;i<n;i++)
    {
        if((s[i]>='A' and s[i]<='Z') or (s[i]>='a' and s[i]<='z'))
            {
                x++;
                x1=x;
                if(k==true)
                k=false;
            }
        else
            if(k==false and x1!=0)
            {
                q++;
                k=true;
            }
    }
    x1=0;
    }
    if(q>0)
        g<<x/q;
    else
        g<<0;
    return 0;
}