• + 1 comment
    import re 
    
    N = int(input())
    
    hex_code = r'#[0-9A-Fa-f]{3,6}(?=[^\w-])'
    
    css_colors = []
    
    for _ in range(N):
        line = input()
        css_colors.extend(re.findall(hex_code, line))
        
    print('\n'.join(css_colors)) 
    
    • + 0 comments

      {3,6} doesn't mean 3 OR 6, it means 3–6. I.e., 3, 4, 5, or 6.