What are the explanation steps for palindrome program?
If you want to check whether a string is a palindrome, you can
reverse the string (for example, the Java class StringBuffer has a
reverse() method), and then compare whether the two strings - the
original string and the reverted string - are equal. Alternately,
you could write a loop that checks whether the first character of
the string is equal to the last one, the second is equal to the
second-last one, etc.; that is, you have a counter variable (in a
"for" loop) that goes from zero to length - 1 (call it "i"), and
compare character #i with character #(length-i-1) inside the
loop.