Finding the maximum of an array to solve a rope-burning puzzle
Space complexity

In terms of space, you can solve this in \$O(1)\$ space.
In other words, you don't need upper, lower, and result arrays.
You can calculate the rolling max while parsing the values of upper and lower without storing them.

Time complexity

You are performing \$N\$ operations several times, where \$N\$ is the total length - 1:


scan the elements of upper
scan the elements of lower
find the max of upper - lower pairs
find the max of the max values


That looks like \$O(4N)\$. If you rewrite as I suggested, without extra storage and calculating the rolling max as you go,
this can be reduced to \$O(2N)\$, since only the first two traversals remain, which is inevitable to read the input.

That being said, 
since \$O(4N)\$ and \$O(2N)\$ are of the same magnitude (linear),
I'd be surprised if this made a difference for the time limit exceeded result.
Usually TLE happens when there is a magnitude of difference between the expected solution and the actual (for example quadratic instead of linear).

Extra tips

Use an enhanced for loop when you don't need the value of the index.
For example instead of:


          for(int i = 0; i &lt; result.length; i++){
            if(maxVal &lt; result[i]){
                maxVal = result[i];
            } 
          }



Write as:

          for(int val : result) {
            if(maxVal &lt; val){
                maxVal = val;
            } 
          }




These loop conditions are identical, but written differently:


         for(int i = 0; i &lt; totalLength - 1; i++){
         // ...
         for(int i = 0; i &lt;= totalLength - 2; i++){
         // ...



It's easier to read if you adopt a more consistent writing style.



Instead of doing all the work in the main method,
it would be better to decompose this to multiple methods.
In the decomposed solution you should have a method that takes some input (possibly even a Scanner),
and return some output instead of printing it directly.
When written that way,
unit testing becomes possible.
And then of course, add some unit tests.