Pagini recente » Cod sursa (job #2299543) | Cod sursa (job #2671244) | Monitorul de evaluare | Cod sursa (job #1581246) | Cod sursa (job #2383314)
#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;
fin.getline(s, 1005);
for (int i = 0; s[i]; i++)
{
if (lit(s[i]))
x++;
if (i != 0 && lit(s[i - 1]) && (!lit(s[i]) || fin.eof()))
y++;
}
if (y == 0)
fout << 0 << '\n';
else
fout << x / y << '\n';
return 0;
}