Python easy solution | beats 100%
\r\n\r\n## Code\r\n\r\nclass Solution:\r\n    def displayTable(self, orders: List[List[str]]) -> List[List[str]]:\r\n        menu, dic, lst = [], {}, []\r\n\r\n
![image.png](https://assets.leetcode.com/users/images/f11b6212-8734-4d3f-9fe6-8c849d01fee1_1675230098.1084623.png)\r\n\r\n## Code\r\n```\r\nclass Solution:\r\n    def displayTable(self, orders: List[List[str]]) -> List[List[str]]:\r\n        menu, dic, lst = [], {}, []\r\n\r\n        for i in orders:\r\n            tbn, food = int(i[1]), i[-1]\r\n            \r\n            if not tbn in dic:\r\n                dic[tbn] = {\r\n                    food : 1\r\n                }\r\n            else:\r\n                if food in dic[tbn]:\r\n                    dic[tbn][food] += 1\r\n                    \r\n                else:\r\n                    dic[tbn][food] = 1\r\n            \r\n            menu.append(food)\r\n                \r\n        menu = sorted(list(set(menu)))\r\n        menu.insert(0, "Table")\r\n\r\n        for i in sorted(dic.keys()):\r\n            c = [str(i)]\r\n            for j in menu[1:]:\r\n                if not j in dic[i]:\r\n                    c.append("0")\r\n                else:\r\n                    c.append(str(dic[i][j]))\r\n                    \r\n            lst.append(c)\r\n            \r\n        lst.insert(0, menu)\r\n        return lst\r\n```
['Python', 'Python3']