fork download
  1. #include "bits/stdc++.h"
  2. using namespace std;
  3.  
  4. int main() {
  5. string line;
  6. int cr=0,mx=0;
  7. while(getline(cin,line)){
  8. if(line.length()==0){
  9. mx=max(cr,mx);
  10. cr=0;
  11. }
  12. else{
  13. int t = stoi(line);
  14. cr += t;
  15. }
  16. }
  17. mx=max(cr,mx);
  18. cout<<mx;
  19. }
Success #stdin #stdout 0.01s 5408KB
stdin
5
5
6

4
3
12
stdout
19