GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.hackerrank.com — Validating Postal Codes | HackerRank 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. A valid postal code have to fullfil both below requirements:
Alternating repetitive digits are digits which repeat immediately after the next digit. In other words, an alternating repetitive digit pair is formed by two equal digits that have just a single digit between them. For example: 121426 # Here, 1 is an alternating repetitive digit. 523563 # Here, NO digit is an alternating repetitive digit. 552523 # Here, both 2 and 5 are alternating repetitive digits. Your task is to provide two regular expressions
Both these regular expressions will be used by the provided code template to check if the input string is a valid postal code using the following expression: (bool(re.match(regex_integer_in_range, P)) and len(re.findall(regex_alternating_repetitive_digit_pair, P)) < 2) Input Format Locked stub code in the editor reads a single string denoting from stdin and uses provided expression and your regular expressions to validate if is a valid postal code. Output Format You are not responsible for printing anything to stdout. Locked stub code in the editor does that. Sample Input 0 110000
Sample Output 0 False
Explanation 0 1 1 Note: Cookie support is required to access HackerRankSeems like cookies are disabled on this browser, please enable them to open this website |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |