We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
regex_integer_in_range=r"^[100000-999999]{6}$"#Donotdelete'r'.# Not more than one ARD pairregex_alternating_repetitive_digit_pair=r"(\d)(?=\d\1)"#Donotdelete'r'.'''source:StackOverflowExplanation:(\d):Matchandcaptureadigitingroup#1(?=:Startlookahead\d:Matchanydigit\1:Back-referencetocapturedgroup#1):Endlookahead'''importreP=input()print(bool(re.match(regex_integer_in_range,P))andlen(re.findall(regex_alternating_repetitive_digit_pair,P))<2)
Please Login in order to post a comment