Some characters count twice
<p>Right now I'm trying to find the longest sentence in text and print out number of characters including spaces and things like that. The problem is when I encounter characters like 'š' or 'á' it counts them twice. I tried to subtract one in those cases, but that doesn't seem to work either, because it subtracts them twice too. Any idea how I could fix that? Here is the code for the counter.</p>

<pre><code>for i:=1 to length(text) do
      case text[i] of 
        '.','!','?': begin
                        if len&gt;p2 then p2:=len;
                        len:=0
                     end;
         else inc(len);
       end;
</code></pre>

<p>p2 is a counter for longest sentence and len is current sentence.</p>