#include #include #include int main () { char cur[20]; int cur_sum = 0; int max = 0; int second = 0; int third = 0; while (fgets(cur,20,stdin) != NULL) { if (strlen(cur) > 1) { cur_sum += atoi(cur); if (cur_sum > max) { max = cur_sum; } else if (cur_sum > second) { second = cur_sum; } else if (cur_sum > third) { third = cur_sum; } } else { cur_sum = 0; } } printf("%d\n", max+second+third); }