From a80266876e94565d875fd6f302ea7fc8ef7cb02b Mon Sep 17 00:00:00 2001 From: Aakrisht69 <115407142+Aakrisht69@users.noreply.github.com> Date: Thu, 20 Oct 2022 00:31:02 +0530 Subject: [PATCH] Create PalinString.cpp Hacktoberfest Submission. #13 --- Cpp/PalinString.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Cpp/PalinString.cpp 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; +}