• + 0 comments

    print (bool(re.match(r'^[1-9][\d]{5}$',s) and len(re.findall(r'(\d)(?=\d\1)',s))<2 ))

    In this just replcae blanks with re.math value, i.e -'^[1-9][\d]{5}$' and re.findall value with '(\d)(?=\d\1)' in the hackerrank IDE