Pagini recente » Istoria paginii runda/winners11 | Cod sursa (job #1569861) | Istoria paginii utilizator/trutzaionutz | Istoria paginii runda/1543 | Cod sursa (job #1123485)
#include <fstream>
#define DEBUG 0
#if DEBUG
#include <iostream>
#endif
using namespace std;
int main()
{
ifstream in("text.in");
ofstream out("text.out");
int l = 0, c = 0;
char t;
bool swL = false;
bool swC = false;
while (in.get(t))
{
#if DEBUG
cout << "t(" << t << ") ";
#endif
if ((t>='a'&&t<='z')||(t>='A'&&t<='Z'))
{
++l;
swC = true;
#if DEBUG
cout << "l(" << l << ") swC(" << swC << ") swL(" << swL << ") c(" << c << ")\n";
#endif
if (swL)
{
++c;
swL = false;
#if DEBUG
cout << "c(" << c << ")\n";
#endif
}
}
else if (t=='-')
{
#if DEBUG
cout << "swL(1)\n";
#endif
swL = true;
}
else if (swC)
{
++c;
swC = false;
#if DEBUG
cout << "c(" << c << ")\n";
#endif
}
}
--c;
#if DEBUG
cout << l/c;
#endif
out << l/c;
return 0;
}