Incrementing characters being read
<p>I am trying to decode an input file that looks something like this: </p>

<pre><code>abbaabbbbaababbaabababaabababaabbababaabababababababa...
</code></pre>

<p>and compare it to a makeshift mapping I have made using two arrays</p>

<pre><code>int secretNumber[10];
string coding[10];

coding[0]="abb";
coding[1]="aabbbba";
coding[2]="abab";
...
</code></pre>

<p>I am not sure how I can start off by reading the first character which is 'a' then check if it's in the coding array. If it is print out the secretCoding and move the next character b. Else if it's not in the array then add the next character to the first in a string and check to see if "ab" is in the array and if that isn't either add the next character which makes "abb" and so on.</p>

<p>Something like this:</p>

<pre><code>while (!(readFile.eof()) ){

  for(int i=0; i&lt;10; i++){

    if(stringOfChars==coding[i]){
      cout &lt;&lt; secretNumber[i] &lt;&lt;endl;
      //Now increment to next char
    }

    else{

      //combine the current string with the next character  
    }
  }
}
</code></pre>

<p><strong>Question:</strong> How do I go about reading in a character if its a match move to next character if not combine current character and the next character until there's a match. </p>
