diff --git a/Cpp/PalinString.cpp b/Cpp/PalinString.cpp new file mode 100644 index 0000000..95beecb --- /dev/null +++ b/Cpp/PalinString.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; + +// Function to check whether +// the string is palindrome +string isPalindrome(string S) +{ + // Stores the reverse of the + // string S + string P = S; + + // Reverse the string P + reverse(P.begin(), P.end()); + + // If S is equal to P + if (S == P) { + // Return "Yes" + return "Yes"; + } + // Otherwise + else { + // return "No" + return "No"; + } +} + +// Driver Code +int main() +{ + string S = "ABCDCBA"; + cout << isPalindrome(S); + + return 0; +}