Pagini recente » Cod sursa (job #237870) | Cod sursa (job #1329694) | Cod sursa (job #64151) | Cod sursa (job #566718) | 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);
}