Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Cpp/PalinString.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <bits/stdc++.h>
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;
}