HI,I am trying to solve this problem without any success.Is it a valid scenario:
although expected 3 lines but in input only have two line?
No this is not a valid scenario for the given question.
Try to solve the problem for the deafult ipnut provided in the question.
As stated, expected output for this input is 2.