I was using online compiler. So, I was feeding output statically in an array.
And I guess I made it wrong once, so, I started using same input.
But they give different input on each attempt.
I guess I need to make a read file code and execute it locally.