Sort by

recency

|

393 Discussions

|

  • + 0 comments
    • import re
    • import string
    • jinx = []
    • powder = []
    • p = r'#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?\b'
    • for _ in range(int(input())):
    • inpt = input()
    • if ';' in inpt:
    • isha = re.findall(p,inpt)
    • jinx.append(isha)
    • for pow in jinx:
    • for color in pow:
    • powder.append(color)
    • print('\n'.join(powder))
  • + 0 comments

    ` Import re

    for _ in range(int(input())): for hex_code in re.findall(r"(?<=.)#[\dA-Fa-f]{3,6}", input()): print(hex_code) `

  • + 0 comments
    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
    import sys, re
    
    text = sys.stdin.read().splitlines()[1:]
    HEX_pattern = r"[#][0-9a-f]{3,6}"
    
    index_list = []
    line_list = []
    match = ''
    
    i = 0 
    for line in text:
        if not re.search(r"^(#|{|})", line): 
                index_list.append(i)
        i+=1
    
    for index in index_list:
        line_list.append(text[index])
    
    match ='\n'.join(re.findall(HEX_pattern, ''.join(line_list), flags=re.I))
    print(match)
    
  • + 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)]