string is a palindrome or not program in ruby code example
Example: palindrome index explained in ruby
# Complete the palindromeIndex function below. def palindromeIndex(s) # slen = s.length splt = s.split('') n = s.reverse nsplt = n.split('') if n == s return -1 elsif n != s splt.each do |p| if nsplt[p] != splt[p] return p end end else return -1 end end