I need a bit of help with a homework problem. I think I have a good start I am unsure how to break up a string letter by letter so that I can push it into a stack. This is the exact question and the code I have made so far:
Write a function that uses a stack (i.e. it has a stack as a local variable) to determine whether a string is in the language L, where:
L = {ww' : w is a string of characters, w' = reverse(w)}
1 2 3 4 5 6 7 8 9
bool isIn (const string w)
{
if ((w.length() % 2 == 1) || (w.length() < 2) || (w.isEmpty))
returnfalse;
else {
while (!(w.isEmpty))
push() //how do you break up the string??
}