Questions tagged [palindrome]

A word, phrase, number, or other sequence of units that may be read the same way in either direction, forward or backward.

A word, phrase, number, or other sequence of units that may be read the same way in either direction, forward or backward.

Spacing and punctuation is generally ignored when attempting to determine whether the potential palindrome under consideration is in fact a palindrome. One such example is:

I, madam, I, made radio - so I dared! Am I mad? Am I?

(from http://www.joe-ks.com/palindromes.htm)

1763 questions
0
votes
2 answers

Menu driven palindrome tester getting stack Overflow error

I'm doing this for a class, and I'm really not terribly awesome at this as I'm over a decade out of practice. I'm trying to write a program that displays a menu so the user can choose between methods of determining if it's a palindrome. It then…
0
votes
6 answers

IndexError when checking if input is palindrome using while loop

I'd like to know how do I check if an input is a palindrome with a while loop, using Python. Thanks: i tried this i = 0 n = len(msg_list) while i < n: palindrome = msg_list[i] if palindrome == msg_list[-1]: print("Palindrome?…
astdium
  • 11
  • 1
  • 1
  • 5
0
votes
6 answers

Palindrome program - string index out of range exception

I've written code for my CS class to identify if a user inputted string is a palindrome or not. I've gotten the code to work. However, whenever I execute the code I get this message: "Exception in thread "main"…
DewyT
  • 31
  • 2
  • 5
0
votes
2 answers

Python Palindrom program using Stacks

My assignment was to come up with a palindrome program in python. Which I did here def isPalindrome(word): for i in range(len(word)//2): if word[i] != word[-1-i]: return False return True print (isPalindrome("maam"))…
user2052503
  • 19
  • 1
  • 2
0
votes
2 answers

How to find if a number if palindrome using recursion?

I'm trying to check if a number is a palindrome. I have written the code to check if a string is a palindrome using recursion, but I'm having a hard time writing the one to check for numbers. I'm passing just the number to the method, nothing else…
user2027425
  • 389
  • 3
  • 5
  • 14
0
votes
3 answers

Largest Palindrome

I have succeeded in determining which two numbers when multiplied produces a numerical palindrome in C#, however I need to sort the products from lowest to highest. Is there anyway to do this? static void LargestPalindrome() { ulong product =…
M Coder
  • 63
  • 8
0
votes
2 answers

The Next Palindrome .. Strange Character Output

I made this code that is supposed to increment a number till get the next palindrome number of of this inputted number. The program take the number as string " cause it may be a very big digits number ( 0 < digits < 1000000 ) " .... The…
Mahmoud
  • 197
  • 1
  • 5
  • 16
0
votes
3 answers

how to count the number of words of the same(PALINDROME) in java

I'm a newbie Java Developer. I want to write code to count the number of palindrome words in the paragraph using Java. The assumptions are : User can enter a paragraph containing as many sentences as possible. Each word is separated by a whitespace,…
Mar
  • 1
  • 1
  • 1
0
votes
3 answers

Debugging for loop in palindrome numbers code

This code gets an integer n and displays all palindrome numbers less than n. But seems the for loop doesn't work; because when I enter a number except 0, 1 and negatives, nothing happens. I tried debugging, but couldn't find the problem! Sample…
Aura
  • 61
  • 1
  • 1
  • 5
0
votes
1 answer

How to calculate total score in a palindrome game between two players?

My program alternatively prompt two players for a palindrome each then based on its type (sentence, word or digits) assign it a score. it keeps prompting the players for palindromes and calculate and display the total score of each player. The…
0
votes
1 answer

How does one implement a recursive palindrome checker using regular expressions?

So far I've been using ^[a-zA-Z]+( [a-zA-z]+)*$ to make sure user input Has no space in the beginning and the end and not to accept numbers or special characters and only to accept alphabetical characters. I looked at the regex list online and in my…
SelfDeceit
  • 107
  • 1
  • 2
  • 13
0
votes
1 answer

testing palindromes with nested loops ONLY

I need to write a program that gets a string from the user and tests to see if it's a palindrome. This has to be done with nested loops: I can't write a method to return the answer. I also have to keep accepting string inputs and testing them…
mattjulian
  • 23
  • 1
  • 7
0
votes
1 answer

How to count the number of words that are palindromes in a string?

I'm obviously new to the forums and need some help. I'm writing a program that shows the number of vowels, words, and palindromes within a sentence. I'm at the end of my rope and am completely lost. I'm using C and I'm trying to loop through the…
user1713221
  • 3
  • 1
  • 4
0
votes
2 answers

Finding the palindrome of a number in c

This code don't give me the right answer and i couldn't find the mistake. How can i fix the code? Scenario: First it determines number's number of digits and then palindromes the number. #include #include #include int…
Dorukcan Kişin
  • 1,121
  • 2
  • 14
  • 29
0
votes
1 answer

C++ Palindrome program

I find myself oddly perplexed on this homework assignment. The idea is to create a Palindrome program, using a specific header the professor wants us to use, but for some reason, when I run it, right after I enter the phrase the program crashes on…
user1675108
  • 83
  • 1
  • 2
  • 12