#include<iostream>
#include<cctype>
#include<string>
#include<cstdlib>
#include"Palindrome.h"
using namespace std;
struct Node
{
string pharse;
Node* next;
};
int main()
{
Stack S1;
Queue Q1;
string word;
int length;
cout << "Do you know what a Palindrome is?\n";
cout << "It is a word that is the same spelling backwards and forward\n";
cout << "Enter in a word ";
getline(cin, word);
//cout.flush();
length = word.length();
string NewWord1[length];
string NewWord2[length];
for(int c =0; c < length; c++)
{
NewWord1[c] = word[c];
NewWord2[c] = word[c];
}
for(int c =0; c < length; c++)
{
cout << NewWord1[c];
cout << endl;
cout << NewWord2[c];
cout << endl;
}
cout << "end";
S1.push(NewWord1, length);
Q1.enqueue(NewWord2, length);
Node temp2 = S1.pop();
Node temp3 = Q1.dequeue();
if(temp2 == temp3)
cout << "They are palindrome.";
else
cout << "They are not palindrome.";
/*S1.pop();*/
return 0;
}
void Stack :: push(string NewWord1[], int size)
{
//cout << NewWord1[0];
if(!isFull())
{
for(int i = 0; i < size; i++)
{
Node *temp = new Node;
temp -> pharse = NewWord1[i];
temp -> next = head1;
head1 = temp;
}
}
}
// pop and enqueue return a Node which is my structure.