title: To compare two strings and remove the same characters from string 1 and print the string 2 using C++
body: <p>I am a newbie in programing and stuck at a point where I have to compare the two strings using C++: string 1 and string 2 for the same characters and then delete those characters from string 1 and print the string 2. Looking forward for your help. My code goes like this:</p>
  
  <pre><code>#include&lt;string&gt;
  #include&lt;iostream&gt;
  #include&lt;conio.h&gt;
  
  using namespace std;
  
  int main()
  {
      string first_string;
      string second_string;
      string::size_type start_position=0;
  
      cout&lt;&lt;"Please enter the first string: "&lt;&lt;endl;
      getline(cin,first_string);
  
      cout&lt;&lt;"Please enter the Second string: "&lt;&lt;endl;
      getline(cin, second_string);
  
      while ( (start_position = second_string.find(first_string, start_position)) != string::npos )
      {
      while ( (start_position = second_string.find(first_string, start_position)) != string::npos )
      {
          second_string.replace( start_position, first_string.size(), "" );
          start_position++;
      }
      }
      cout&lt;&lt;"The Result is as follws: "&lt;&lt;second_string&lt;&lt;endl;
      getch();
      return 0;
  
  }
  </code></pre>
  
  <p>Looking forward for your help.</p>
  
  <p>Regards,
  Sam</p>