(C++) 2117. Abbreviating the Product of a Range
\n\nclass Solution {\npublic:\n    string abbreviateProduct(int left, int right) {\n        int highest = 0, trailing = 0; \n        long prefix = 1, suffix = 1
\n```\nclass Solution {\npublic:\n    string abbreviateProduct(int left, int right) {\n        int highest = 0, trailing = 0; \n        long prefix = 1, suffix = 1; \n        \n        for (int x = left; x <= right; ++x) {\n            prefix *= x; \n            suffix *= x; \n            for (; prefix >= 1e12; ++highest, prefix /= 10); \n            for (; suffix % 10 == 0; ++trailing, suffix /= 10); \n            if (suffix >= 1e10) suffix %= 10\'000\'000\'000; \n        }\n        \n        for (; prefix >= 1e5; ++highest, prefix /= 10); \n        highest += log10(prefix); \n        if (highest - trailing < 10) return to_string(suffix) + "e" + to_string(trailing); \n        suffix %= 100\'000; \n        return to_string(prefix) + "..." + string(5-to_string(suffix).size(), \'0\') + to_string(suffix) + "e" + to_string(trailing); \n    }\n};\n```
['C']