Pagini recente » Cod sursa (job #995206) | Cod sursa (job #1396195) | Cod sursa (job #1240536) | Cod sursa (job #1193749) | Cod sursa (job #2383358)
#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 n = strlen(s);
bool k = 0;
for (int i = 0; i <= n; i++)
{
if (lit(s[i]))
{
k = 1;
x++;
}
else if (k == 1)
{
y++;
k = 0;
}
}
}
if (y == 0)
fout << 0 << '\n';
else
fout << x / y << '\n';
return 0;
}