C++ Math Solution
\n1. We can always store first 12 digits of and last 12 digits of the multiplication as upper and lower\n2. We can count the number of digits in final product u
```\n1. We can always store first 12 digits of and last 12 digits of the multiplication as upper and lower\n2. We can count the number of digits in final product using Log formula\n3. We can count number of trailing zero by incrementing counter when lower digit is 0\n4. We can get first and last 5 digits of upper and lower from their 12 digit\n```\n\n```\nclass Solution {\npublic:\n    string abbreviateProduct(int left, int right) {\n       \n        // upper 12 digit of product\n        double upper = 1;\n        \n        // lower 12 digit of product\n        long long lower = 1L;\n        \n        // offset to make 12 digit in upper and lower\n        long long Offset = 1e12;\n        \n        // offset to make 5 digit in upper and lower\n        long long cutOffset = 1e5;\n        \n        // store log value of the product        \n        double product = 0.0;\n        \n        // count trailing zero in the product\n        int trailing = 0;\n        \n        for(int i=left;i<=right;i++)\n        {\n            // update log value of product\n            product +=  log10(i);\n            \n            // multiple value with upper and lower 12 digit\n            upper *= i;\n            lower *= i;\n            \n            // keep 12 digit in upper\n            while(upper>=Offset)upper/=10;\n            \n            // remove trailing zeroes\n            while(lower%10==0)lower/=10,trailing++;\n            \n            // keep 12 digits in lower\n            lower %= Offset;\n        }\n        \n        // count total digits in product except trailing zeroes\n        int digitLength = (int)product + 1 - trailing;\n        \n        // keep 5 digit in upper and lower\n        while(upper>=cutOffset)upper/=10;\n        lower %= cutOffset;\n        \n        int upperInt = upper;\n        \n        // take digit length digits from upper and lower when digit length <= 10\n        if(digitLength<=10)\n        {\n            // make all digit 0 to tackle missing MSB zeroes in lower\n            string result(digitLength,\'0\');\n            string upperStr = to_string(upperInt);\n            string lowerStr = to_string(lower);\n            \n            for(int i=0;i<upperStr.length() && digitLength >0; i++,digitLength--)\n                result[i] = upperStr[i];\n            \n            for(int k=1;!lowerStr.empty() && digitLength >0; digitLength--,k++)\n            {\n                result[result.length()-k] = lowerStr.back();\n                lowerStr.pop_back();\n            }\n\n            \n            return result + "e" + to_string(trailing);\n        } \n        else\n        {   \n           // take upper and lower 5 digits \n           string result = to_string(lower);\n           return to_string(upperInt) + "..." + string(5-result.size(),\'0\') + result  + "e" + to_string(trailing);\n        }\n    }\n};\n```
['Math', 'C']