Worked example: LISTEN and SILENT
Both inputs normalize to EILNST, so they are exact anagrams. LISTENS and SILENT are not exact because the first input contains an extra S. The checker preserves repeated-letter quantities, which prevents a near match from being reported as equal.
The exact-match proof
- Normalize
- Remove spaces and ignore capitalization.
- Sort
- Create a reproducible alphabetic fingerprint.
- Count
- Check every repeated letter, not only the set of letters.
- Conclude
- Report exact equality or show the mismatch.
Audit a near match
When two inputs fail, inspect the missing and extra letters before changing anything. Make the smallest correction and test again. This turns a yes-or-no result into a reproducible explanation and helps reveal duplicated letters that alphabetical sorting can make easy to overlook.