Cod sursa(job #1529326)

Utilizator Belu99Bibo Bela Belu99 Data 20 noiembrie 2015 19:31:20
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <iostream>
#include <fstream>
using namespace std;
bool k=false;
string s;
long x,i,n,q;
int main()
{
    ifstream f("text.in");
    ofstream g("text.out");
    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++;
                if(k==true)
                k=false;
            }
        else
            if(k==false and x>0)
            {
                q++;
                k=true;
            }
    }
    if(q>0)
        g<<x/q;
    else
        g<<0;
    return 0;
}