title: How to extract letters from separate lines and do something with them?
body: <p>I am writing a program in c++ that takes in letters and prints them out. So, something like:</p>
  <blockquote>
  <p><strong>A</strong>AAAAA</p>
  <p><strong>B</strong>BBBBB</p>
  <p><strong>C</strong>CCCCC</p>
  </blockquote>
  <p>I used a for loop to go through all letters from input, extract each letter using substr and then cout the letter.
  Now, I need to count how many A's are there in the first vertical position (bold letters), which is in this case one and calculate the percentage of A's in the vertical column.
  How do I do that? I am confused and any help is appreciated!</p>
  <p>Thanks!</p>
  <p>this is the code:</p>
  <pre><code>while(s &lt; numberL) 
  {
    sp = word;
    s++
    for (int i = 0; i &lt; correct.length(); i++)
    {
        if(answer.at(i) == correct.at(i)) 
        {
             word = answer.substr(i,1); 
             cout &lt;&lt; word;
        }
        if ( answer.at(i) != correct.at(i) &amp;&amp; answer.at(i) != '?')
        { 
             word = answer.substr(i,1);
             cout &lt;&lt; word;
        }
        if (answer.at(i) == '?') 
        {
             word = answer.substr(i,1);
             cout &lt;&lt; word; 
        }
      
     }
    }
  </code></pre>