Cod sursa(job #1557818)
Utilizator | Data | 28 decembrie 2015 12:34:11 | |
---|---|---|---|
Problema | Text | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.65 kb |
#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;
}