[C++] Brute Force
Thanks for @linfq\'s solution, here is the C++ version. \n\n\nclass Solution {\npublic:\n    string abbreviateProduct(int left, int right) {\n        int c = 0;
Thanks for <code>@linfq</code>\'s solution, here is the C++ version. \n\n```\nclass Solution {\npublic:\n    string abbreviateProduct(int left, int right) {\n        int c = 0;\n        long long pre = 1, suf = 1, mod = 1e12;\n        for (int i = left; i <= right; i++)\n        {\n            long long cur(i);\n            pre *= cur;\n            while (pre > mod)\n                pre /= 10;\n            suf *= cur;\n            while (suf % 10 == 0)\n            {\n                suf /= 10;\n                c++;\n            }\n            suf %= mod;\n        }\n        string pres = to_string(pre), sufs = to_string(suf), ans = "";\n        if (sufs.length() <= 10)\n            ans = sufs + "e" + to_string(c);\n        else\n        {\n            if (sufs.length() < 5)\n                sufs = string(5 - sufs.length(), \'0\') + sufs;\n            ans = pres.substr(0, 5) + "..." + sufs.substr(sufs.length() - 5) + "e" + to_string(c);\n        }\n        return ans;\n    }\n};\n```\n\nDuring the contest, I used the similar method but converted the solution to string for each step, so I got TLE.\n```\nclass Solution {\npublic:\n    string abbreviateProduct(int left, int right) {\n        string ans = convert(left);\n        for (int i = left + 1; i <= right; i++)\n            ans = prod(ans, i);\n        int p = ans.find(\'.\');\n        int q = ans.find(\'e\');\n        if (q > 10)\n            ans = ans.substr(0, 5) + "..." + ans.substr(q - 5);\n        return ans;\n    }\n    \nprivate: \n    string prod(string a, int i)\n    {\n        string b = convert(i);\n        int p = a.find(\'e\'), q = b.find(\'e\');\n        int c = stoi(a.substr(p + 1)) + stoi(b.substr(q + 1));\n        a = a.substr(0, p);\n        b = b.substr(0, q);\n        p = a.find(\'.\');\n        if (p == -1)\n        {\n            long long a1 = stoll(a.substr(0, p)), b1 = stoll(b), c1 = a1 * b1;\n            while (c1 % 10 == 0)\n            {\n                c++;\n                c1 /= 10;\n            }\n            string cs = to_string(c1);\n            if (cs.length() > 12)\n            {\n                string cs1 = cs.substr(0, 12);\n                string cs2 = cs.substr(cs.length() - 12);\n                cs = cs1 + "..." + cs2;\n            }\n            return (cs + "e" + to_string(c));\n        }\n        else\n        {\n            long long a1 = stoll(a.substr(0, p)), b1 = stoll(b), c1 = a1 * b1;\n            p = a.find_last_of(\'.\');\n            long long a2 = stoll(a.substr(p + 1)), c2 = a2 * b1;\n            while (c2 % 10 == 0)\n            {\n                c++;\n                c2 /= 10;\n            }\n            while (c1 % 10 == 0)\n                c1 /= 10;\n            string cs1 = to_string(c1);\n            if (cs1.length() >= 12)\n                cs1 = cs1.substr(0, 12);\n            string cs2 = to_string(c2);\n            if (cs2.length() >= 12)\n                cs2 = cs2.substr(cs2.length() - 12);\n            else\n                cs2 = string(12 - cs2.length(), \'0\') + cs2;\n            string cs = cs1 + "..." + cs2;\n            return (cs + "e" + to_string(c));\n        }\n    }\n    \n    string convert(int i)\n    {\n        int c = 0;\n        while (i % 10 == 0)\n        {\n            i /= 10;\n            c++;\n        }\n        string s = to_string(i) + "e" + to_string(c);\n        return s;\n    }\n};\n```
['C']