Pagini recente » Cod sursa (job #1938554) | Cod sursa (job #2929068) | Cod sursa (job #2692964) | Cod sursa (job #2650764) | Cod sursa (job #1295053)
#include <cstdio>
#include <cstring>
#include <cctype>
using namespace std;
int TotalLen, CntWords, CurrentLen, L;
char C[1100000];
int main()
{
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
gets(C);
L = strlen(C);
for(int i = 1; i <= L; ++ i)
{
if(isupper(C[i]) || islower(C[i])) CurrentLen ++;
else
{
if(CurrentLen) TotalLen += CurrentLen, CntWords ++;
CurrentLen = 0;
}
}
if(CurrentLen) TotalLen += CurrentLen, CntWords ++;
printf("%i\n", TotalLen / CntWords);
}