#C8889. Postal Code Validation

    ID: 52920 Type: Default 1000ms 256MiB

Postal Code Validation

Postal Code Validation

In this problem, you are required to validate a postal code based on a set of rules. The postal code must satisfy the following criteria:

  1. The postal code must be exactly 6 digits long. That is, it should match the regular expression ( ^\d{6}$ ).

  2. The postal code must not contain any strictly increasing or strictly decreasing consecutive sequence of 3 or more digits. For example, sequences such as 123 or 654 are considered invalid.

  3. The postal code must not contain any repeating subsequences of digits of length 2 or more. For instance, if a substring such as ( \texttt{12} ) appears twice consecutively (e.g. 1212...), the postal code is invalid.

Your task is to read a single postal code from the standard input and print either "True" if the postal code is valid according to the above rules, or "False" otherwise.

inputFormat

The input consists of a single line containing the postal code as a string (which should be exactly 6 characters long).

outputFormat

Print exactly one line to the standard output: "True" if the postal code is valid, or "False" if it is not.## sample

124356
True