Pagini recente » Profil aIexpetrescu | Monitorul de evaluare | Istoria paginii monthly-2014/runda-9/solutii | Monitorul de evaluare | Cod sursa (job #2243320)
#include <iostream>
#include <fstream>
#include <math.h>
#include <string>
using namespace std;
int main()
{
ifstream f("text.in");
ofstream g("text.out");
string s;
bool found=false;
char x;
int karak=0;
int szodb=0;
while(f>>s)
{
found=false;
for(int i=0; i<=s.length()-1; i++)
{
x=s[i];
if((x>='a' and x<='z') or (x>='A' and x<='Z'))
{
found=true;
karak++;
}
}
if(found) szodb++;
}
if(found) szodb++;
if(szodb==0) g<<"0"<<endl;
else
g<<(int)karak/szodb<<endl;
return 0;
}