[C++] Brute Force, O(n)
Search how many chunks from 1 to n.\n\nIn each iteration:\nspace is the number of total capacity to fill message.\nlast is the capacity of last chunk.\nramain i
Search how many chunks from 1 to n.\n\nIn each iteration:\n`space` is the number of total capacity to fill message.\n`last` is the capacity of last chunk.\n`ramain` is the number of reamining character after filling the first i-1 chunks.\n\nFunction:\n`digit` is the length of a number.\n`all_len` is the sum of the length of each number from 1 to n.\n```\nclass Solution {\nprivate:\n    int digit(int n){\n        if(n >= 10000) return 5;\n        else if(n >= 1000) return 4;\n        else if(n >= 100) return 3;\n        else if(n >= 10) return 2;\n        else return 1;\n    }\n    int all_len(int n){\n        if(n >= 10000) return 9+2*90+3*900+4*9000+5*(n-9999);\n        else if(n >= 1000) return 9+2*90+3*900+4*(n-999);\n        else if(n >= 100) return 9+2*90+3*(n-99);\n        else if(n >= 10) return 9+2*(n-9);\n        else return n;\n    }\npublic:\n    vector<string> splitMessage(string m, int limit) {\n        if(limit <= 5) return {};\n        int n = m.size();\n        for(int i = 1; i <= n; i++){\n            int space = limit*i-3*i-digit(i)*i-all_len(i);\n            int last = limit-3-digit(i)*2;\n            int remain = n-(space-last);\n            if(remain<0 || remain>last) continue;\n            int idx = 0;\n            vector<string> res(i);\n            for(int j = 1; j < i; j++){\n                int k = limit-3-digit(i)-digit(j);\n                res[j-1] = m.substr(idx, k)+"<"+to_string(j)+"/"+to_string(i)+">";\n                idx += k;\n            }\n            res[i-1] = m.substr(idx)+"<"+to_string(i)+"/"+to_string(i)+">";\n            return res;\n        }\n        return {};\n    }\n};\n```
['C++']