title: How to find some words in previously read lines and delete it in output- read/write strings in c++
body: <p>I am reading a text file in c++ and writing a bunch of paired numbers from it to another file. </p>
  
  <p>The structure of input file is a bunch of paired numbers and some lines like "remove120 43 blah bla" that indicates removing one of the previous paired numbers, in this case 120 43( that surely exists in one of the previous lines).</p>
  
  <p>So, each time there is a word "remove" in a line, i want to find its paired numbers in the previous lines and delete it from my output.</p>
  
  <p>P.S. I have provided this input file in past, but I am not good in working with strings at this point which makes this confusion for me. </p>
  
  <p>I started like this:</p>
  
  <pre><code>string s;
  ifstream myfile("input.txt");
  ofstream output ("output.txt");
  
  if(myfile.is_open()){
      while (!myfile.eof()){
          getline (myfile, s);
  .
  .
  .
  </code></pre>