#include <iostream>
#include <string>
using namespace std;

string plural(string n)
{
  if(n[n.length()-1]=='y')
    {
      string add="ies";
      n=(n.insert(n.length()-1, add, 0, add.length()));
      n[n.length()-1]='\0';
    }
  else
    if(n[n.length()-1]=='s')
      {
	string add="es";
	n=n+add;
      }
    else
      if((n[n.length()-2]=='c')&&(n[n.length()-1]=='h'))
	{
	  string add="es";
	  n=n+add;
	}
      else
	if((n[n.length()-2]=='s')&&(n[n.length()-1]=='h'))
	  {
	    string add="es";
	    n=n+add;
	  }
	else
	  {
	    string add="s";
	    n=n+add;
	  }
  return n;
}//plural

void reverse(string n)
{

  cout << n << endl;
}//reverse

int main()
{
  string n;
  cout << "Enter in a noun to pluralize (type 'stop' to end)" << endl;
  cin >> n;

  while(n!="stop")
    {
      cout << plural(n) << endl;
      cout << "Enter in a noun to pluralize (type 'stop' to end)" << endl;
      cin >> n;
    }

  cout << "Enter in a sentence that will be reversed" << endl;
  cin >> n;
  reverse(n);

  return 0;
}//main


