title: Length of a string which is got from getline()
body: <p>I have the following codes:</p>
  
  <pre><code>ifstream file(filename);
  for(string word; getline(file, word);){
      if(word.size() == letters){
          cout &lt;&lt; "word: " &lt;&lt; word &lt;&lt; endl;
          cout &lt;&lt; "size: " &lt;&lt; word.size() &lt;&lt; endl;
          dict.push_back(word);
      }
  }
  </code></pre>
  
  <p>In the codes, <code>filename</code> is a dictoinary file like "dict.txt". In the "dict.txt" is like this:</p>
  
  <pre><code>aa
  aah
  aahed
  aahing
  aahs
  ...
  </code></pre>
  
  <p>As showed above, there are just many words in it. Assume that <code>letters</code> is 13. So I think the codes should print words that have 13 letters, like <code>abacterialope</code>. But actually it prints words that have 12 letters, while <code>word.size()</code> is 13.</p>
  
  <p>So, why can this happen? As in my memory, <code>size()</code> should print the number of characters in a <code>string</code>.</p>