Pagini recente » abcqq | Istoria paginii runda/proba123/clasament | Cod sursa (job #267069) | Cod sursa (job #1128968) | Cod sursa (job #1852314)
#include <cstdio>
#include <climits>
#include <algorithm>
using namespace std;
#ifdef INFOARENA
#define ProblemName "fractal"
#endif
#define MCONCAT(A, B) A B
#ifdef ProblemName
#define InFile MCONCAT(ProblemName, ".in")
#define OuFile MCONCAT(ProblemName, ".out")
#else
#define InFile "fis.in"
#define OuFile "fis.out"
#endif
typedef long long LL;
int tlen, tnum;
void update(char *b) {
int clen = 0;
for(;;++b) {
char c = *b;
if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')
++clen;
else {
if (clen) {
tlen += clen;
++tnum;
clen = 0;
}
if (!c) break;
}
}
}
const int BUFSZ = 8192 * 1024;
char buf[BUFSZ];
int parse() {
tlen = tnum = 0;
while (1) {
int rez = fread(buf, 1, BUFSZ, stdin);
if (rez <= 0) break;
buf[rez] = 0;
update(buf);
}
return tlen / tnum;
}
int main() {
freopen(InFile, "r", stdin);
freopen(OuFile, "w", stdout);
printf("%d\n", parse());
return 0;
}