class Solution {
public:
vector<int> printListFromTailToHead(struct ListNode* head) {
std::stack<int> nodes;
vector<int> outnodes;
ListNode *pNode = head;
while (head != NULL)
{
nodes.push(head->val);
head = head->next;
}
while (!nodes.empty())
{
outnodes.push_back(nodes.top());
nodes.pop();
}
return outnodes;
}
};