text: #include "../../include/solution.h"
  
  class Solution {
     public:
      int maxSubArray(vector<int>& nums) {
          // dp[i] = max(dp[i-1] + nums[i], nums[i])
          int cur = nums[0];
          int res = cur;
          int n = nums.size();
          for (int i = 1; i < n; ++i) {
              cur = max(nums[i] + cur, nums[i]);
              res = max(cur, res);
              // cout << cur << " ";
          }
          return res;
      }
  };
  
  int main() {
      string line;
      while (getline(cin, line)) {
          vector<int> nums = stringToIntegerVector(line);
  
          int ret = Solution().maxSubArray(nums);
  
          string out = to_string(ret);
          cout << out << endl;
      }
      return 0;
  }