C++ Solution, solve it without rotate and rotate it at the end.
\n### Idea\nThe idea is ASCII(#) < ASCII(.), so it is the same that we put the # to the right side and . to the left side by using sort.\n- Find all the left bo
\n### Idea\nThe idea is ASCII(#) < ASCII(.), so it is the same that we put the `#` to the right side and `.` to the left side by using sort.\n- Find all the left bound and right bound for each row, and then sort the interval by desc.\n- rotate the matrix (2 nested loops). The same problem: https://leetcode.com/problems/rotate-image/\n\n### Complexity\n- Time O(mnLog(n))\n- Space O(mn)\n### Solution\n- C++\n```\nclass Solution {\npublic:\n    vector<vector<char>> rotateTheBox(vector<vector<char>>& box) {\n        int m = box.size(), n = box[0].size();\n        for(int i = 0; i < m; i++) {\n            int prev = n;\n            int j = prev - 1;\n            while(j >= 0) {\n                while(j >= 0 && box[i][j] != \'*\') --j;\n                sort(box[i].begin() + j + 1, box[i].begin() + prev);\n                reverse(box[i].begin() + j + 1, box[i].begin() + prev);\n                prev = j;\n                --j;\n            }\n        }\n        vector<vector<char > > ans(n, vector<char>(m));\n        for(int i = 0; i < m; i++) {\n            for(int j = 0; j < n; j++) {\n                ans[j][i] = box[i][j];\n            }\n        }\n        for(int i = 0; i < n; i++) {\n            for(int j = 0; j < m/2; j++) {\n                swap(ans[i][j], ans[i][m - j - 1]);\n            }\n        }\n        return ans;\n    }\n};\n```
[]