"""A word count: texts as a dict's keys, counted in the order they first appear (T30)."""


# (the dict is built in the function's result: an extended return in Vada, as Ada returns
# its limited containers; counts stop at a thousand, which the prover can see)
def count_words(words: list[str]) -> dict[str, int]:
    counts: dict[str, int] = {}
    for w in words:
        if w in counts:
            if counts[w] < 1000:
                counts[w] = counts[w] + 1
        elif len(counts) < 1000:
            counts[w] = 1
    return counts
