The conversation between human and AI assistant.
How can we reverse a stack by using only push() and pop() operations without using any secondary DS?
Yes, that would be great. Thank you!
```
void reverseStack(stack<int> &s) {
  if (!s.empty()) {
    int temp = s.top();
    s.pop();
    reverseStack(s);
    insertAtBottom(s, temp);
  }
}

void insertAtBottom(stack<int> &s, int x) {
  if (s.empty()) {
    s.push(x);
  } else {
    int temp = s.top();
    s.pop();
    insertAtBottom(s, x);
    s.push(temp);
  }
}
```

This code defines two functions, `reverseStack()` and `insertAtBottom()`. The `reverseStack()` function recursively pops all elements from the original stack and inserts them into the stack in reverse order using the `insertAtBottom()` function. The `insertAtBottom()` function recursively pops all elements from the stack until it is empty, and then pushes the new element to the bottom of the stack.