class Solution {
public:
    vector<int> printListFromTailToHead(ListNode* head) {
        vector<int> s;
        while(head!=NULL)
        {
            s.insert(s.begin(),head->val);
            head=head->next;
        }
        return s;
    }
};