You should be able to shorten this a bit by using `re.sub`, like `reduce(lambda t, prefix: re.sub("^" + prefix+ "\s", "", t, 1), prefixes, text)` (or looping). This will delete both "A" and "The" in "A The studid name" instead of only one, though.