✔✔✔ Brute Force ⁉ || Simple Approach || C++ || Explained
As the problem required to find minimum number of parts, Let us traverse from 1 to see if we can divide our message with current number of parts.\n\nLet us do s
As the problem required to find minimum number of parts, Let us traverse from 1 to see if we can divide our message with current number of parts.\n\nLet us do some calculation now.\n\n<b>What will be the length of the string after we attach the extra info "<a/b>" with each part?</b>\n\nLet the number of parts  = <b>N</b>\nThen with each part we will attach "</>". Hence we need extra <b>3*N</b> character.\nWe will also attach the value b= N with each part.Then we need extra <b>Nx(number of digits in N)</b>.\nFinally we will attach the value of <b>a </b> with each part, which requires the <b>sum of number of digits from 1 to N</b>.\nHence the actual size of string will be = <b>N + 3*N + Nx(number of digits in N) +  <span>&Sigma;</span>(number of digits from 1 to N)<b>\n\nNow we just need to check if we can divide the size in N parts where each part will contain <b>limit</b> characters except the last one.\n\nSample Code:\n```\nclass Solution {\npublic:\n    vector<string> splitMessage(string message, int limit) {\n        vector<int>dig(10001),cum_sum(10001);// contains number of digits in N and cumulative sum of number of digits.\n        // find number of digits in X.\n        auto number_of_digits=[](int x){\n            int ret = 0;\n            while(x){\n                ret++;\n                x/=10;\n            }\n            return ret;\n        };\n        for(int i=1;i<=10000;i++){\n            dig[i] = number_of_digits(i); \n            cum_sum[i] = cum_sum[i-1]+dig[i];\n        }\n        \n        int actual_size = message.size();\n        vector<string>ret;\n        for(int N=1;N<=actual_size;N++){\n            int newSize = actual_size+3*N+dig[N]*N+cum_sum[N];\n            \n            //check if possible to achieve the result.\n            if((newSize+limit-1)/limit==N){\n                string s;\n                int cur = 1;\n                //for each part we need to add <a/b> with it\n                int extra = dig[N]+3;//as a part changes we do it in runtime\n                for(char&c:message){\n                    s+=c;\n                    if(s.size()+dig[cur]+extra==limit){\n                        s+="<"+to_string(cur)+"/"+to_string(N)+">";\n                        ret.push_back(s);\n                        s.clear();\n                        cur++;\n                    }\n                }\n                //if last part contains less than limit characters.\n                if(s.size()){\n                      s+="<"+to_string(cur)+"/"+to_string(N)+">";\n                        ret.push_back(s);\n                        s.clear();\n                }\n                return ret;\n            }\n        }\n        return ret;\n    }\n};\n```\n\n
['C']