bool checkPalindrome(string inputString) { return inputString == string(inputString.rbegin(), inputString.rend()); } code example

Example: bool checkPalindrome(string inputString) { return inputString == string(inputString.rbegin(), inputString.rend()); }

#include <iostream>
#include <string>

using namespace std;
bool checkPalindrome(string);
int main()
{
    string inputString = "palindrom";
    cout << checkPalindrome(inputString);
	return 0;
}

bool checkPalindrome(std::string inputString)
{
   return (inputString == string(inputString.rbegin(), inputString.rend()));
}