Palindrome is a string that is identical to its reverse, like "level" or "aba". Check whether a given string is a palindrome or not.
Create a class SimpleString that manipulates a given string of characters. This class contains proper constructor functions (default constructor and copy constructor) and supports the following operations (in the form of member functions):
To check if a given string is a palindrome, we have provided another class PalindromeChecker as follows:
class PalindromeChecker
{
public:
PalindromeChecker(const SimpleString &s)
{
str = s;
rev = s;
rev.reverse();
};
void isPalindrome()
{
if(rev == str)
std::cout << "Yes\n";
else
std::cout << "No\n";
};
private:
SimpleString str;
SimpleString rev;
};
Note:
This problem involves three files.
You will be provided with main.cpp and function.h, and asked to implement function.cpp.
Note that you don’t need to implement class PalindromeChecker
function.h
main.cpp
The input consists of multiple lines. Each line contains a string. The length of each string is less than 100000. The number of test case is less than 1000.
For each test case, output "Yes" if it's a palindrome or "No" if it's not a palindrome in a line.