Pagini recente » Cod sursa (job #2417543) | Cod sursa (job #16464) | Cod sursa (job #957032) | Cod sursa (job #1607544) | Cod sursa (job #329864)
Cod sursa(job #329864)
#include "fstream"
std::ifstream in("text.in");
std::ofstream out("text.out");
#define N_MAX 500
int apr(int lg)
{
if((lg<=122&&lg>=97)||(lg<91&&lg>=65))
return 1;
else
return 0;
}
int main ()
{
char sv[N_MAX];
int NrCuv=0,NrLit=0;
while(!in.eof())
{
in>>sv;
int s_lx=strlen(sv);
int i=0;
int lit=sv[i];
while(apr(lit))
{
i++;
lit=sv[i];
}
if(i==s_lx)
{
NrCuv++;
NrLit+=s_lx;
}
else
if(lit==45)
{
NrCuv+=2;
NrLit+=s_lx-1;
}
}
NrLit+=2;
NrCuv+=2;
out<<NrLit/NrCuv;
return 0;
}