Pagini recente » Istoria paginii utilizator/johnnycode | Monitorul de evaluare | Istoria paginii utilizator/makeitcount | Istoria paginii utilizator/dascalu2 | Cod sursa (job #1557818)
#include <iostream>
#include <fstream>
using namespace std;
bool k=false;
string s;
long x=0,i,n,q=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++;
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;
}