Vendor Service String Verification

Problem Vendors submit hotel-service strings ("tree wifi") that must be verified against a catalog of known terms ("free wifi"): if the input differs from a known term by at most one character, auto-correct it to that term; otherwise reject with an exception back to the vendor.

Input / Output

  • Input: vendor string, set of valid service terms.
  • Output: the corrected/validated term, or a thrown validation error.

Constraints

  • Clarify "one character": substitution only, or also insert/delete (edit distance ≤ 1)? Case/whitespace normalization first? Ties when two catalog terms both match?

Example

  • "tree wifi" → "free wifi" (one substitution). "tea wifi" → exception (distance 2).
asked …
LeaderboardSalaryAccount