tried with custom input and it work absolutely fine dont know why its not passing the test cases.
hello @ashishxmathew
check now->