Keypad Type-1 (only one test case is passing)

Only 1 test case is passing
My Code : [https://ide.codingblocks.com/s/634339]