title: How to reverse a substring of a string in c++?
body: <p>I want to reverse a substring in a string. For example <br></p>
  
  <pre><code>string x = "foobar";
  </code></pre>
  
  <p>So I want to reverse <code>foo</code> to be <code>oof</code> so x would be <code>"oofbar";</code>
  Here's a sample of what I have tried: <br></p>
  
  <pre><code>string x = "foobar";
  size_t pos = x.find("foo");
  reverse(x.begin() + k, s.end()); // I got stuck here.
  </code></pre>