The above code checks whether a char is part of a word - "if not (text[i ] in Whitespace) then..."

Each time that condition is true, you've found a word This means that you can change it to have a counter for the word length - you just have to figure out whether you're doing a *new* word (just started, first letter of it) or are continuing to see the current word.

"if not DoingWord" means that you've just hit a new word. if that's the case, you set the counter to 1 (first letter). Otherwise, you're still on the same word - add one to that counter.

You'd also want to set the counter to 0 if it *was whitespace*. Before that, you'd want to check the length of the counter. If 0, do nothing (no word was there). If 1..10 then add to the 1..10 bundle. Otherwise, put it in the greater than ten count. Example pseudocode, based on above:

[pascal][background=#FFFFFF][normal=#000080][number=#C00000]
[string=#00C000][comment=#8080FF][reserved=#000000]function ...
const
...
var
...
WordLength: Integer;
OneToTen: Integer;
OverTen: Integer;
begin
...

WordLength := 0;
OneToTen := 0;
OverTen := 0;

for ...
begin
if not (text[i ] in whitespace) then // *not* whitespace, = a valid word
begin
if not DoingWord then
begin
...
WordLength := 1; // start of new word
end
else
begin
Inc(WordLength); // continuing this word
end;
end
else // found whitespace
begin
// Not a word. If WordLength > 0 then
// we've recently been doing a word, but have found
// the end. Therefore, check its length and increase
// the appropriate count

if WordLength > 0 then
begin
if WordLength in [1..10] then
Inc(OneToTen)
else
Inc(OverTen);
end

DoingWord := False;
WordLength := 0;
end;
end;
end;[/pascal]
Gotta love string manipulation :mrgreen: