Pagini recente » Cod sursa (job #1489178) | Cod sursa (job #773020) | Cod sursa (job #1032556) | Cod sursa (job #2834840) | Cod sursa (job #2211991)
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
const char WHITE_SPACE(32);
int main()
{
char ch;
int cnt=0,ok=0,lit=0;
while(fin>>ch)
{
// fout<<"spatiu "<<ok<<endl;
if(ch>='a' && ch<='z' || ch>='A' && ch<='Z')
{
ok++;
lit++;
}
else
{
if(ok>0)
{cnt++;
}
ok=0;
}
if (fin.peek() == WHITE_SPACE )
{
if(ok>0)
{cnt++;
}
ok=0;
}
}
if(cnt!=0)
fout<<lit/cnt;
else
fout<<0;
return 0;
}