Answer:
See explaination
Step-by-step explanation:
#include <iostream>
#include<string.h>
using namespace std;
bool isPalindrome(string str, int lower, int upper){
if(str.length() == 0 || lower>=upper){
return true;
}
else{
if(str.at(lower) == str.at(upper)){
return isPalindrome(str,lower+1,upper-1);
}
else{
return false;
}
}
}
int main(){
string input;
cout<<"Enter string: ";
cin>>input;
if(isPalindrome(input,0,input.length()-1)){
cout<<input<<" is a palindrome"<<endl;
}
else{
cout<<input<<" is NOT a palindrome"<<endl;
}
return 0;
}