Stack question: pop out in a pattern
At run time I want to input two types of datatype, double and string.
One of the condition is that String should pop in the order I input, and double will pop as the usual stack behaviour, FIFO. Another condition is that the stack is limited to max size 10

E.g. one runtime example

**Input** `Hello 1 World 2 blah blah 3 4 5`

**Output** `Hello 5 World 4 blah blah 3 2 1`


My first question is how many ways is there to solve this problem?
I have solved this problem using 3 stacks, one which stores double, one which store strings, and one which is used to reverse the string order.

I need to save the pattern so the program know which order the doubles comes, thus I save the pattern to the string stack. Since the stack is limited to size 10, I will need to save the pattern in another way.

So this is how my string stack will look like after the push

1. Hello*
2. World*
3. blah
4. blah***

So when at the first read I need to make specific read in that Stack position and just extract Hello out of it. Asterisk * is left for later use when I tell the program next pop is an double.

My second question is that I wonder if there is some other more elegant solution to this problem. Since my solution will involve some string manipulation to solve this problem. And as for now I'm not actually using the pop function in the string case as it is supposed to be used. I made the solution in C++ btw.
Stack question: pop out in a pattern
===

At run time I want to input two types of datatype, double and string.
One of the condition is that String should pop in the order I input, and double will pop as the usual stack behaviour, FIFO. Another condition is that the stack is limited to max size 10

E.g. one runtime example

**Input** `Hello 1 World 2 blah blah 3 4 5`

**Output** `Hello 5 World 4 blah blah 3 2 1`


My first question is how many ways is there to solve this problem?
I have solved this problem using 3 stacks, one which stores double, one which store strings, and one which is used to reverse the string order.

I need to save the pattern so the program know which order the doubles comes, thus I save the pattern to the string stack. Since the stack is limited to size 10, I will need to save the pattern in another way.

So this is how my string stack will look like after the push

1. Hello*
2. World*
3. blah
4. blah***

So when at the first read I need to make specific read in that Stack position and just extract Hello out of it. Asterisk * is left for later use when I tell the program next pop is an double.

My second question is that I wonder if there is some other more elegant solution to this problem. Since my solution will involve some string manipulation to solve this problem. And as for now I'm not actually using the pop function in the string case as it is supposed to be used. I made the solution in C++ btw.