#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <cassert>
#include <iterator>
#include <algorithm>
 
using namespace std;
 
class LargeInteger {
private:
    static int nextLargeIntegerId;
    int id;
    string digits; // the digits of the LargeInt we are representing
 
public:
    LargeInteger(int value);
    ~LargeInteger();
    string tostring();
};
 
LargeInteger::LargeInteger(int value)
{
    // set this instance id
    id = nextLargeIntegerId++;
 
    // iterate through the digits in value, putting them into our
    // array of digits.
    unsigned char digit;
    while(value) {
        // least significant digit
        digit = value % 10;
        digits += digit;
 
        // integer division to chop of least significant digit
        value = value / 10;
    }
}
 
LargeInteger::~LargeInteger()
{
    cout << " destructor entered, freeing my digits" << endl
         << " id = " << id << endl
         //<< " value=" << tostring() // uncomment this after you implement tostring()
         << endl;
}
 
string LargeInteger::tostring()
{
    string intValue(digits.size(),' ');
 
    transform (digits.rbegin(), digits.rend(), intValue.begin(), [](auto &x){return x+'0'; }) ; 
    return intValue;
}
int LargeInteger::nextLargeIntegerId = 0; 
 
int main() {
    // test constructors, destructors and tostring()
    cout << "Testing Constructors, tostring() and destructor:" << endl;
    cout << "-------------------------------------------------------------" << endl;
    LargeInteger li1(3483);
    cout << "li1 = " << li1.tostring() << endl;
 
    return 0;
}
				I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8Y2Fzc2VydD4KI2luY2x1ZGUgPGl0ZXJhdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNsYXNzIExhcmdlSW50ZWdlciB7CnByaXZhdGU6CiAgICBzdGF0aWMgaW50IG5leHRMYXJnZUludGVnZXJJZDsKICAgIGludCBpZDsKICAgIHN0cmluZyBkaWdpdHM7IC8vIHRoZSBkaWdpdHMgb2YgdGhlIExhcmdlSW50IHdlIGFyZSByZXByZXNlbnRpbmcKCnB1Ym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