"""
Exercise 1: word frequency counter

Implement word_frequencies(text) that returns a dict mapping each
lowercase word to how many times it appears, using ONLY split()/lower()
and a plain dict (no collections.Counter — that's the point of the
exercise). Punctuation-free words separated by whitespace only.

  word_frequencies("the cat sat on the mat")
  -> {"the": 2, "cat": 1, "sat": 1, "on": 1, "mat": 1}

The returned dict's key order must match first-appearance order (this
is automatic if you build it by iterating the words in order and using
dict.get/setdefault rather than sorting).
"""

def word_frequencies(text):
    # TODO: implement using a plain dict.
    pass


# --- self-check: do not modify below this line ---
result = word_frequencies("the cat sat on the mat")
expected = {"the": 2, "cat": 1, "sat": 1, "on": 1, "mat": 1}

order_ok = list(result.keys()) == list(expected.keys())
values_ok = result == expected

print(f"result={result!r}")
print("PASS" if (order_ok and values_ok) else "FAIL")
