C++ mini BigInt implementation
IntuitionThe key is to handle large products by tracking both leading and trailing digits separately while counting trailing zeros.Approach
Use BigInt class to
# Intuition
The key is to handle large products by tracking both leading and trailing digits separately while counting trailing zeros.

# Approach
1. Use BigInt class to store large numbers in base 10^13 chunks for leading digits
2. Track trailing digits separately modulo 10^10 to prevent overflow
3. Count trailing zeros by dividing out factors of 10

# Code
```cpp []
class BigInt {
public:
    BigInt(long long val, int keep_lead_digs = -1) : keep_lead_digs(keep_lead_digs) {
        for (; val > 0 || data.empty(); val /= kDig)
            data.push_back(val % kDig);
        reverse(data.begin(), data.end());
    }

    void operator*=(long long m) {
        long long inherit = 0;
        for (int i = beg; i < data.size() || inherit > 0; ++i) {
            if (i == data.size())
                data.resize(i + 1);
            long long r = m * data[i] + inherit;
            inherit = r / kDig;
            data[i] = r % kDig;
        }
        if (keep_lead_digs > 0)
            beg = max<int>(0, data.size() - keep_lead_digs);
    }

    string to_string() const {
        ostringstream oss;
        int i = data.size() - 1;
        oss << data[i] << ::setfill('0') << ::setw(kDecCount);
        for (--i; i >= beg; --i)
            oss << data[i];
        return oss.str();
    }

private:
    static constexpr int kDecCount = 13;
    static const long long kDig;
    static const string kLeadZeroFmt;

    vector<long long> data;
    int beg = 0;
    int keep_lead_digs = -1;

    static long long calculate_kdig() {
        long long val = 1;
        for (int i = 0; i < kDecCount; ++i)
            val *= 10;
        return val;
    }
};

const long long BigInt::kDig = calculate_kdig();
const string BigInt::kLeadZeroFmt = "%0" + ::to_string(kDecCount) + "lld";


class Solution {
public:
    string abbreviateProduct(int left, int right) {
        BigInt bint(left, 5);
        int tzc = 0;
        long long trail = left;
        for (int i = left + 1; i <= right; ++i) {
            bint *= i;
            trail *= i;
            for (; trail % 10 == 0; trail /= 10)
                ++tzc;
            trail %= kTrailAccMod;
        }
        trail %= kTrailResMod;

        string s = bint.to_string();
        for (; !s.empty() && s.back() == '0'; s.pop_back());
        ostringstream oss;
        if (s.length() > 10)
            oss << string_view(s.c_str(), 5) << "..." << ::setfill('0') << ::setw(5) << trail;
        else
            oss << s;
        oss << "e" << tzc;

        return oss.str();
    }

private:
    static constexpr long long kTrailAccMod = 1e10;
    static constexpr long long kTrailResMod = 1e5;
};

```
['C++']