#include<cstring>
#include<iostream>
 
class stringb
{

public:
    stringb() :
        p (new char[25]), len(25)
    {
    }
     stringb(char* s) :
        p (new char[std::strlen(s)])
    {
        len = std::strlen(s);
        std::strcpy (p, s );
    }

    stringb (const stringb& other) :
        p (new char[std::strlen (other.p) + 1]), len(std::strlen (other.p))
    {
        std::strcpy (p, other.p );
    }
 
    /** Move Constructor  Since C++11*/
    stringb (stringb&& other) :
        p (other.p),len(0)
    {
        other.p = nullptr;
    }
 
    /** Destructor */
    ~stringb()
    {
        delete[] p;
    }
 
    /** Copy Assignment Operator */
    stringb& operator= (const stringb& other)
    {
        stringb temporary (other);
        std::swap (p, temporary.p);
        return *this;
    }
 
    /** Move Assignment Operator Since C++11*/
    stringb& operator= (stringb&& other)
    {
        std::swap (p, other.p);
        return *this;
    }
 
private:
    char* p;  
    std::size_t len;
        friend std::ostream& operator<< (std::ostream& os, const stringb& stringb)
    {
        os << stringb.p;
        return os;
    }
    

    friend stringb operator+(const stringb &a,const stringb &b)
    {
        stringb temp;
        temp.len = a.len + b.len;
        temp.p=new char[(temp.len)+1];
        std::strcpy(temp.p, a.p);
        std::strcat(temp.p, b.p);
        return (temp);
    }
    
    /* Not sure what this will do */
    friend stringb operator-(const stringb &a,const stringb &b)
    {   
        stringb temp;
        temp.len=a.len-b.len;
        temp.p=new char[temp.len+1];
        std::strcpy(temp.p,a.p);
        return (temp);
    }
};



int main()
{
    stringb a("POW");
    stringb b("JACK");

    stringb c;
    c=a+b;
    std::cout<< c<< ","<<a<<","<<b;
}