class Solution{
public:
//Function to check whether the list is palindrome.
bool isPalindrome(Node *head)
{
//Your code here
stack<int> s;
Node *t;
t=head;
while(t)
{
s.push(t->data);
t=t->next;
}
t=head;
while(t)
{
if(s.top()==t->data)
{
s.pop();
}
t=t->next;
}
if(s.empty()) return true;
else return false;
}
};