Answer
//include header files
#include<iostream>
#include<string>
#include<cstdlib>
#include<cmath>
using namespace std;
string sWord[]={"he", "him","his"};
string sword1[]={"she or he","her or him", "hers or his"};
//Return true if ch is alphabet
bool IsAlphabet(char ch)
{
 if(((ch>='A') &&( ch<='Z'))||((ch>='a') && (ch<='z')))
   return true;
 return false;
}
//replace gender word
string replaceStrWord(string word)
{ Â
 string rep="";
 for(int kk=0;kk<3;kk++)
 { Â
   if(sWord[kk]==word)
   {
     rep=sword1[kk];     Â
   }
 }
 if(rep.compare("")==0)
   rep=word;
 return rep;
}
//main()
int main()
{
 string output="";
 char next_symbol;
 string word="";
 //Repeat until user done;
 while(true)
 {
   output="";
 //Loop to get entire sentence
 do
 {
   word="";
   //Loop to get word
   while(true)
   {
     cin.get(next_symbol);
     if(IsAlphabet(next_symbol))
     {
       word+=next_symbol;
     }
     else
     {
  Â
       break;
     }
Â
   };
Â
   if(word.compare("done")==0)
   break;
    output=output+replaceStrWord(word);
    output=output+next_symbol;
 }while(next_symbol!='\n');
 cout<<"Replaced String:"<<output<<endl;
 string userdone="";
 cout<<"Do u wantto continue:";
 cin>>userdone;
 if(userdone=="no")
   break;
     cin.ignore();
 }
 return 0;
}