Pagini recente » Cod sursa (job #1441835) | Cod sursa (job #2619512) | Cod sursa (job #2866499) | Cod sursa (job #1235624) | Cod sursa (job #1295054)
#include <cstdio>
#include <cstring>
#include <cctype>
using namespace std;
int TotalLen, CntWords, CurrentLen;
char C;
int main()
{
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
while(scanf("%c", &C) == 1)
{
if(isupper(C) || islower(C)) CurrentLen ++;
else
{
if(CurrentLen) TotalLen += CurrentLen, CntWords ++;
CurrentLen = 0;
}
}
if(CurrentLen) TotalLen += CurrentLen, CntWords ++;
printf("%i\n", TotalLen / CntWords);
}