Code Room
CodingMediumcod-g1387
Subject StringsLevel Entry–Mid~14 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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) → str
Examples
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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.