I am getting run error on test cases 6, 7 and 8. I have run these cases by providing custom input and they are running properly and also giving the correct result.
I have uploaded the code here: https://ide.codingblocks.com/s/232900
Please let me know where I have gone wrong. Thank you!