Pagini recente » Cod sursa (job #2893930) | Cod sursa (job #328015) | Cod sursa (job #1351951) | Cod sursa (job #2935752) | Cod sursa (job #2383366)
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int lit(char x)
{
if ((x <= 'Z' && x >= 'A') || (x <= 'z' && x >= 'a'))
return 1;
return 0;
}
int main()
{
int x = 0, y = 0, nr = 0;
char c;
while (fin.get(c))
{
if (lit(c))
{
nr++;
if (nr == 1)
y++;
}
else
{
x += nr;
nr = 0;
}
}
if (y == 0)
fout << 0 << '\n';
else
fout << x / y << '\n';
return 0;
}