import re


def filter_out_comments(text):
    """Removes one-line and multi-line comments."""
    text = re.sub(r'//(?:(?!\*/).)*$', '', text, flags=re.M)
    text = re.sub(r'(?<!/)/\*.*?\*/', ' ', text, flags=re.S)
    text = re.sub(r'//.*?$', '', text, flags=re.M)
    return text