Pagini recente » Cod sursa (job #803209) | Cod sursa (job #1025537) | Cod sursa (job #1025595) | Cod sursa (job #1994437) | Cod sursa (job #2383341)
#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;
}
char s[10005];
int main()
{
int x = 0, y = 0;
while (fin.getline(s, 1005))
{
int nr = 0;
for (int i = 0; s[i]; i++)
{
if (lit(s[i]))
{
nr++;
if (nr == 1)
y++;
}
else
{
x += nr;
nr = 0;
}
}
}
if (y == 0)
fout << 0 << '\n';
else
fout << x / y << '\n';
return 0;
}