palindromic string using one if block