title: Python: how to get the next sequence of a list of lists based on a condition?
body: <p>I used an NLP chunker that splits incorrectly the term 'C++' and 'C#' as: C (NN), +(SYM), +(SYM), C (NN), #(SYM).</p>
  <p>The resulting list of incorrect chunking looks like this:</p>
  <pre><code>l = [['C', 'NN'], ['+', 'SYM'], ['+', 'SYM'], ['C', 'NN'], ['#', 'NN']]
  </code></pre>
  <p>I would like to post-process this list, by identifying the strings in index 0 of each list that are 'C' and the next in line '+', '+' or '#'. Then I'd like to concatenate these strings, so that 'C','+','+' becomes 'C++' by simply adding these together. This has to be generalisable, so it should work with lists that contain multiple different words, but still concatenate the desired strings.</p>
  <p>desired result:</p>
  <pre><code>l_desired = [['C++', 'NN'], ['C#', 'NN']]
  </code></pre>
  <p>I can identify the items in the list independently (index 0) but I don't know how to go about identifying the desired sequence. My idea was to use the <code>next()</code> function, although I do not know where to begin.</p>