Compare Two String With Optional Characters : consider we have a function (in Django || python) which compares two strings, one is the correct answer and another is student answered string.

    correct = '(an) apple (device)'
    student_answerd = 'apple device'

I want to check student_answered with the correct string but parentheses are optional it means all the below student_answered is correct:

    case 1: an apple device
    case 2: an apple
    case 3: apple device

notice: we don't have the same correct format for all questions it means the location of parentheses is different for example maybe we just have one parentheses or more.