Getting NoSuchElementException

I was not able to get the algorithm behind this problem. I checked out the editorial and got it. In,my latest submission, that same code is working fine on Eclipse IDE but giving an error (mentioned above) when executed in CB IDE.

Hi @Syed-Siddiqui-2497215583854102,
You cannot have two scanner variables in one program … That leads to buffer issues … i have passed the scanner input into the function through parameter and it works fine
check code here : - https://ide.codingblocks.com/s/240062

Thank you Sir. This worked but in Eclipse taking Scanner two times was not throwing an error.

Happy to help. Please resolve the doubt ,

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.