Modified [removed return,changed name to isPalindrome and changed the loop to take input till q/Q]