title: Find similar numbers in a sequence and record the max consecutive streak
body: <p>I have a long sequence of numbers and i want to record the longest consecutive streak of numbers in the list.</p>
  
  <p>I want to increment a counter each time a number has a difference of 10 or less than the previous number. Example:</p>
  
  <pre><code>1
  53
  32
  74
  74
  75
  75
  74
  98
  2
  2
  4
  3
  2
  3
  1
  3
  2
  </code></pre>
  
  <p>74,74,75,75,74 would be counted because they are less than 10 off from each other. So that would be a streak of 5. After that there's a 98 and an even longer streak. So since there's a longer streak the counter needs to discard the previous streak since it's not the biggest one. It basically resets.</p>
  
  <pre><code>list of numbers i'm working with: https://pastebin.com/aga6kkq2
  </code></pre>
  
  <p>Here is my current code:</p>
  
  <pre><code>vector&lt;int&gt; numbers;
  for (int i = 0; i &lt; numbers.size() - 1; i += 2)
      {
          cout &lt;&lt; numbers[i] &lt;&lt; " first set \n" &lt;&lt; numbers[i + 1] &lt;&lt; " second set " &lt;&lt; endl;
          int b = numbers[i];
          int a = numbers[i + 1];
          int difference = b - a;
          if (difference &lt;= 10)
          {
              count++;
              if (difference &gt; 10) {
                  break;
              }
          }
      }
  </code></pre>
  
  <p>This gets the 1st pair of numbers and subtracts them for the difference to see if it's less than 10. I'm sure there's a way better approach. It isn't accurate and is off by 4. The longest consecutive streak in this list should be 140. What would be the correct way to achieve this?</p>