/************************************
Write a program that reads in a string
from the user and tells the user whether
or not it is a palindrome.
************************************/#include <iostream>#include <string>usingnamespacestd;boolreverses(strings1, strings2);intmain(){// Get strings A and BstringA;cout<<"Enter string: ";cin>>A;// Print whether A and B are reversescout<<"String is ";if(!reverses(A,A))cout<<"not ";cout<<"a palindrome!"<<endl;return0;}// Tests whether s1 and s2 are reverses of one anotherboolreverses(strings1, strings2){// Get lengths and make sure they're equal!intN1=s1.size(), N2=s2.size();if(N1!=N2)returnfalse;// test forward on s1 and reverse on s2intF=0, R=N1-1;while(R>=0){if(s1[F]!=s2[R])returnfalse;F++;R--;}returntrue;}