Inverted Hour Glass pattern

My program is not passing any of the test cases,while with user input, it is generating the correct pattern as it was supposed to