title: How do I check if an element occurs more than twice in an array, subject to a string pattern?
body: <p>I'm using Ruby 2.4.  I know how to check if an eleemnt has never occurred more than twice in an array, using</p>
  
  <pre><code>data_arr.count(string) &lt;= 2
  </code></pre>
  
  <p>but what if my array is </p>
  
  <pre><code>["1/5", "2/6", "3/5", "4/7", "3/8", "3/9"]
  </code></pre>
  
  <p>how do I check that the first number before the "/" never occurs more than twice when it is found before the "/"?  That is, in the above example, "1" never occurs more than twice (only in the element "1/5") but "3" occurrs 3 times before the "/".</p>