Program to print following pattern in C++ : <p>How can I produce the following pattern in C++ considering the input has odd digits.</p>

<pre><code>P         M
 R      A
   O  R
     G
  O    R
 R       A
P          M 
</code></pre>

<p>I tried the following code but I don't know how to proceed with it.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstring&gt;
using namespace std;

int main()
{
    char word[100];
    int len, temp;
    cout &lt;&lt; "Input word with odd letters: \n";
    cin &gt;&gt; word;
    len = strlen(word);
    cout &lt;&lt; "Entered word was : "&lt;&lt; word &lt;&lt; " and of size: " &lt;&lt; strlen(word) &lt;&lt; "\n";
    if(len % 2==0)
    {
        cout &lt;&lt; "Please enter a word with odd number of letters!";
    }
    else
    {
        int mid;
        mid = (len - 1)/2;
        cout &lt;&lt; "The middle number is : " &lt;&lt; mid+1 &lt;&lt; " and character is " &lt;&lt; word[mid] &lt;&lt; "\n";
        temp = len - 1;
        for(int i=0; i&lt;len; i++)
        {
            // Some logic to display it just like above
        }
        cout &lt;&lt; "done" &lt;&lt; endl;
    }
}
</code></pre>
