• + 0 comments
    import re
    pattern = r'#[0-9A-Fa-f]{6}\b|#[0-9A-Fa-f]{3}\b'
    n = int(input().strip())
    inside = False
    for _ in range(n):
        t = input()
        if "{" in t: 
            inside = True
        elif "}" in t: 
            inside = False
        elif inside:
            [print(x) for x  in re.findall(pattern,  t)]