#include<iostream>
using std::cout;
using std::ostream;
class string // simple string class
{
int length; // length of string
char *contents; // pointer to contents of string
void copy(const string&);
public:
friend ostream& operator <<(ostream& output,const string &str);
friend string& operator +(const string& str,const char chars[]);
friend string& operator +(const char chars[],const string& str);
string(const string&);
string& operator =(const string& str);
// Get length of string
// return: the length of string
int get_length() const { return length; }
// Get contents of string
// return: the pointer to contents of string
char* get_contents() const{ return contents; }
// Constructor
string() { contents=0; length=0; }
// destructor
~string() { delete []contents; }
// To set and modify contents of the string
// parameters: in_length - length of string set
// in_contents - contents of string set
// return: the length of string set
int set_contents(int in_length, char *in_contents);
// The overloaded of the above function
// parameters: in_contents - contents of string set
// return: the length of string set
int set_contents(char* in_contents);
// Show the contents of string
void print() const{ cout << contents; }