#include <string>
#include <iostream>

using namespace std;

bool palindrome_internal( const string& s, string& reverse, int i )
{
    if(i < s.size()){
        reverse[i] = s[s.size()-(i+1)]; // first character in reverse is the last character in s
        palindrome_internal( s , reverse , i + 1);
    }

    return s == reverse;
}

bool Palindrome(const string& s ){
    string reversed { s }; // initialized here

    return palindrome_internal( s , reversed , 0 ); // And passed to recursive function
}

int main()
{
    cout << Palindrome( "example" ) << endl; // Not palindrome
    cout << Palindrome( "repaper" ) << endl; // Palindrome
    cout << Palindrome( "rotator" ) << endl; // Palindrome
    cout << Palindrome( "madam" ) << endl; // Palindrome
    cout << Palindrome( "" ) << endl; // Palindrome
    cout << Palindrome( "" ) << endl; // Palindrome
}
