Skip to content

Latest commit

 

History

History

validating-postalcode

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Validating Postal Codes

https://www.hackerrank.com/challenges/validating-postalcode

Problem

A valid postal code P have to fullfil both below requirements:

  1. P must be a number in the range from to inclusive.
  2. P must not contain more than one alternating repetitive digit pair.

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.

Input Format

Locked stub code in the editor reads a single string denoting P from stdin and uses provided expression and your regular expressions to validate if P 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

My Solution