title: Want to reverse my String location and special character should be there as it is
body: <p>I've a String as Input like </p>
  
  <pre><code>input = 'apple&amp;&amp;bat&amp;&amp;&amp;cat&amp;&amp;dog&amp;elephant'
  </code></pre>
  
  <p>and i want to reverse the words and special character should be remains same in their place.</p>
  
  <pre><code>Output - 'elephant&amp;&amp;dog&amp;&amp;&amp;cat&amp;&amp;bat&amp;apple' 
  </code></pre>
  
  <p>Exactly, i don't know in which approach i have to solve this problem.
  But, yes i've tried this</p>
  
  <p>with this i got the reverse word but how to place the '&amp;' in their respective position i don't know.  </p>
  
  <pre><code>input = 'apple&amp;&amp;bat&amp;&amp;&amp;cat&amp;&amp;dog&amp;elephant'
  
  ab = input.split('&amp;')[::-1]
  
  print ab
  </code></pre>
  
  <p>output</p>
  
  <pre><code>['elephant', 'dog', '', 'cat', '', '', 'bat', '', 'apple']
  </code></pre>
  
  <p>But my output should be </p>
  
  <pre><code>'elephant&amp;&amp;dog&amp;&amp;&amp;cat&amp;&amp;bat&amp;apple'
  </code></pre>