title: In-place replacement of a pattern in a string
body: <p>In an interview I was asked a question on strings.
  The problem is given a string <strong>s1= "ABCDBCCDABCD"</strong>. and a <strong>pattern "BC"</strong>. we have to replace this pattern with other string ("UVW" or "U"or "uv").
  This need to be down in-place.</p>
  
  <pre><code>    Take the case as:  
            replace "BC" with  following 
   a) "uvw"   s1=AUVWDUVWCDAUVWD .
   b)  "U"    s1=AUDUCDAUD .
   c)  "UV"   s1=AUVDUVCDAUVD .
  </code></pre>
  
  <p>It will be helpful you someone provide a program along with algorithm.</p>