Make one line fit the measure
This toy line composer models word spacing. It is not a Linotype emulator. Every letter is assigned one arbitrary unit; spaces may expand. Real type has unequal widths, mechanical limits and operator choices.
The count excludes spaces from letters, then distributes remaining width equally among word gaps. A gap below one unit is called overfull in this simplified model. One word has no internal word gap to expand.