Skip to content
DeepForgeby svx
All problems
HardNLPnlp-391

Exact Match After Normalization

Problem

QA exact match compares lowercased strings after removing punctuation, collapsing whitespace runs, and stripping ends.

Given the two strings, return True when they match under this normalization.

Hint

Normalize both sides with identical steps before comparing.

Test cases

case 1
in: ["The Cat!","the cat"]
expected: true
case 2
in: ["a-b","a b"]
expected: true
case 3
in: ["Hello","world"]
expected: false
Starter codePython
def exact_match_after_normalization(a, b):
    # Your code here
    pass

3 test cases · run your code against them in the editor