My code is not passing test case 2
u can refer to this code
it is almost the same code, just the final while loop is a bit different, that is when to increment g and when not to
u can refer to this code
it is almost the same code, just the final while loop is a bit different, that is when to increment g and when not to