'Copy and pasting a few lines of inputs into common line is producing something different from typing inputs in one line at a time?

I am writing some code to solve one of Google Codejam' archived questions.

However, I am having some issues with processing the inputs for my code. Here is my code:

T = int(input())

for j in range(1,T+1):
    N = int(input())
    listOfInt = list(map(int,input().split()))
    operationCount = 0
    currentLongest = 0

    for i in range(1,len(listOfInt)):
        currentNumber = listOfInt[i]
        previousNumber = listOfInt[i-1]
        currentLongest = int(currentLongest)
        currentLongest = max(currentLongest,previousNumber)

        if currentNumber> currentLongest:
            pass
        else: #currentNumber <= currentLongest
            currentNumber = str(currentNumber)
            currentLongest = str(currentLongest)
            previousNumber = str(previousNumber)
            if len(currentLongest) == len(currentNumber):
                operationCount += 1
                currentNumber = currentNumber + "0"
            else:
                diff = len(currentLongest) - len(currentNumber)
                operationCount += diff
                currentNumber = currentNumber + (diff * '0')
                if int(currentNumber) < int(currentLongest):
                    currentNumber = currentNumber + "0"
                    operationCount += 1
        currentLongest = max(int(currentLongest), int(currentNumber))
    print(f"Case #{j}: {operationCount}")

And here is one sample of the input:

4
3
100 7 10
2
10 10
3
4 19 1
3
1 2 3

For reference, this is the question that I am solving: https://codingcompetitions.withgoogle.com/codejam/round/000000000043585d/00000000007549e5#problem

Now, when I type in the above inputs line by line, the output produced is as expected:

enter image description here

However, when I copy and paste all of the input at once, I get:

enter image description here

And I believe it is this error that is causing my submissions to fail, because when I check the test cases that my code is run against, it matches everything perfectly, however clearly Case #4 is missed in the latter of the above.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source