Clean email subject
An inbox threads replies by their underlying subject. Given an email subject line, repeatedly strip from the front: any leading spaces, then a prefix 're:' or 'fwd:' (case-insensitive). Keep going until neither rule applies, then return what remains (leading spaces also removed). Only 're:' and 'fwd:' count — 'fw:' or 'reply:' do not. For example, 'Re: RE: fwd: Weekly sync' cleans to 'Weekly sync'.
Implement
clean_subject(subject: str) → strExamples
in
["Re: RE: fwd: Weekly sync"]out"Weekly sync"What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 14 min
solution.py
InputExpectedGot
["Re: RE: fwd: Weekly sync"]"Weekly sync"not run yetsample