#include<iostream>
#include<cstring>
using namespace std;
class base
{
char* p;
int len;
public:
base(char *str){
len = strlen(str);
p = new char[len];
strcpy(p,str);
}
~base(){
delete [] p;
}
base &operator=(base &obj){
if(obj.len>len){
delete [] p;
p = new char[obj.len];
strcpy(p,obj.p);
len = obj.len;
}
return *this;
}
char *display(){
return p;
}
};
int main ()
{
base ob1("go"), ob2("school");
ob1 = ob2;
cout<<ob1.display();
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNzdHJpbmc+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNsYXNzIGJhc2UKewogICAgY2hhciogcDsKICAgIGludCBsZW47CnB1YmxpYzoKICAgIGJhc2UoY2hhciAqc3RyKXsKICAgIGxlbiA9IHN0cmxlbihzdHIpOwogICAgcCA9IG5ldyBjaGFyW2xlbl07CiAgICBzdHJjcHkocCxzdHIpOwogICAgfQogICAgfmJhc2UoKXsKICAgIGRlbGV0ZSBbXSBwOwogICAgfQogICAgYmFzZSAmb3BlcmF0b3I9KGJhc2UgJm9iail7CiAgICBpZihvYmoubGVuPmxlbil7CiAgICAgICAgZGVsZXRlIFtdIHA7CiAgICAgICAgcCA9IG5ldyBjaGFyW29iai5sZW5dOwogICAgICAgIHN0cmNweShwLG9iai5wKTsKICAgICAgICBsZW4gPSBvYmoubGVuOwogICAgfQogICAgcmV0dXJuICp0aGlzOwogICAgfQogICAgY2hhciAqZGlzcGxheSgpewogICAgcmV0dXJuIHA7CiAgICB9Cn07CmludCBtYWluICgpCnsKICAgIGJhc2Ugb2IxKCJnbyIpLCBvYjIoInNjaG9vbCIpOwoKICAgIG9iMSA9IG9iMjsKICAgIGNvdXQ8PG9iMS5kaXNwbGF5KCk7CiAgICByZXR1cm4gMDsKfQo=