#include &lt;iostream&gt;    #include &lt;string&gt;    #include &lt;algorithm&gt;    using namespace std;    int main&#40;&#41;     &#123;        string s = &quot;spaces in text&quot;;        s.erase&#40;remove&#40;s.begin&#40;&#41;, s.end&#40;&#41;, ' ' &#41;, s.end&#40;&#41; &#41; ;        cout &lt;&lt; s &lt;&lt; endl;    &#125;
A. spaces
B. spaces in
C. spaces in text
D. spacesintext
Answer:A
#include &lt;iostream&gt;    #include &lt;string&gt;    #include &lt;algorithm&gt;    using namespace std;    int main&#40;&#41;     &#123;        string s = &quot;spaces in text&quot;;        s.erase&#40;remove&#40;s.begin&#40;&#41;, s.end&#40;&#41;, ' ' &#41;, s.end&#40;&#41; &#41; ;        cout &lt;&lt; s &lt;&lt; endl;    &#125;
A. spaces B. spaces in C. spaces in text D. spacesintext
Explanation:In this program, We formed a alogorithm to remove spaces in the string.