[C++] Record and Build the Table
cpp\nclass Solution {\npublic:\n    vector<vector<string>> displayTable(vector<vector<string>>& orders) {\n        \n        map<int, map<string, int>> table;\n
```cpp\nclass Solution {\npublic:\n    vector<vector<string>> displayTable(vector<vector<string>>& orders) {\n        \n        map<int, map<string, int>> table;\n        set<string> items;\n        \n        for (const vector<string>& order: orders) {\n            string n(order[1]), food(order[2]);\n            table[stoi(n)][food]++;\n            items.insert(food);\n        }\n        \n        int m(table.size()), n(items.size());\n        \n        vector<vector<string>> ans(m + 1, vector<string>(n + 1, "0"));\n        ans[0][0] = "Table";\n        int i(1);\n        \n        for (const string& item: items)\n            ans[0][i++] = item;\n        \n        i = 1;\n        \n        for (const auto&[num, combo]: table) {\n            int j(1);\n            for (const auto&[food, cnt]: combo) {\n                while (ans[0][j] != food) j++;\n                ans[i][j++] = to_string(cnt);\n            }\n            ans[i++][0] = to_string(num);\n        }\n        \n        return ans;\n    }\n};\n```
['Ordered Set']