C++ | Try to find the optimal b, since it is affecting suffix length
we know that the <a/b> suffix is dependent on b and a goes till b,  so if we can somehow try to find the optimal b, we should be able to get the answer.\n\nHow 
we know that the `<a/b>` suffix is dependent on `b` and `a` goes till `b`,  so if we can somehow try to find the optimal `b`, we should be able to get the answer.\n\nHow to find optimal `b` - \n\nWe know that exact `b` does not matter, the only thing that matters is the length of `b`. Since the length of the input string is `10^4`, we know `b` would never have more than `4` digits in suffix.\n\nFirst we try to find out what would be length of `b` in the optimal answer. and we try to build the string. since `a` goes till `b` If we were able to find an optimal `b` then last `a` is your `b` since we are iterating from smallest length to largest length of `b`.\n\n```cpp\nclass Solution {\npublic:\n    int getLength(int n) {\n        return to_string(n).size();\n    }\n    \n    int getPossibleB(const string &message, int &limit) {\n        int n = message.size();\n        for (int b = 1; b <= 4; ++b) {\n            bool isPossible = true;\n            int a = 1;\n            for (int j = 0; j < n; ) {\n                if (getLength(a) > b) {\n                    isPossible = false;\n                    break;\n                }\n                int suffix = 1 + getLength(a) + 1 + b + 1; //<a/b>\n                int rem = limit - suffix;\n                j += rem;\n                ++a;\n            }\n            if (isPossible) return a - 1;\n        }\n        return -1;\n    }\n    \n    vector<string> getSplitString(const string &message, int &limit, int &b) {\n        int n = message.size();\n        int a = 1;\n        vector<string> res;\n        string bstring = to_string(b);\n        for (int j = 0; j < n; ) {\n            string suffix = \'<\' + to_string(a) + \'/\' + bstring + \'>\';\n            int rem = limit - suffix.size();\n            ++a;\n            res.push_back(message.substr(j, rem) + suffix);\n            j += rem;\n        }\n        return res;\n    }\n    \n    vector<string> splitMessage(string message, int limit) {\n        int b = getPossibleB(message, limit);\n        if (b == -1) return {};\n        return getSplitString(message, limit, b);\n    }\n};\n```
[]