Cod sursa(job #1295054)
| Utilizator | Data | 18 decembrie 2014 18:47:01 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#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);
}
